JuliaInterop / MATLAB.jl

Calling MATLAB in Julia through MATLAB Engine
MIT License
269 stars 63 forks source link

using custom matlab function #192

Open MarkusZechner opened 3 years ago

MarkusZechner commented 3 years ago

I am trying to use a custom matlab function in julia but I am getting an error.

I tried to do the following:

mat"""

function [result] = run(x_pos, y_pos)

result = x_pos + y_pos;

end

"""

but I am getting this error:

Error: Function definition not supported in this context. Create functions in code file.

Unrecognized function or variable 'x_pos'.

end; | Error: Illegal use of reserved keyword "end".

How can I use a custom matlab function in julia?

Thanks a lot!

jbarberia commented 2 years ago

My way of working, in case I need to use a matlab function is:

mat""" answer = result($x_pos, $y_pos) """

@mget(answer) end