For example in MatLab, command line I use:
functionname([1 2 3;4 5 6],[1 3 2;7 9 8])
I get a result. But, on windows using cmd
:
functionname "[1 2 3;4 5 6]" "[1 3 2;7 9 8])
This doesn't seem to work.
For example in MatLab, command line I use:
functionname([1 2 3;4 5 6],[1 3 2;7 9 8])
I get a result. But, on windows using cmd
:
functionname "[1 2 3;4 5 6]" "[1 3 2;7 9 8])
This doesn't seem to work.
This question has been answered on How to create a executable .exe file from .m file.
You should use mcc -m yourfile
and it's only work with Matlab installed machines.
One other way could be using .dll
and running it via Visual Studio.
You have to cast the arguments to numerical on demand:
In functionname(a, b), add
if ischar(a)
a = eval(a);
end
if ischar(b)
b = eval(b);
end
Now functionname() can be called with numerical arguments and from the command line with string arguments:
functionname "[1 2 3;4 5 6]" "[1 3 2;7 9 8]"
Note that eval() does the opposite of mat2str().