0

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.

paddy
  • 60,864
  • 6
  • 61
  • 103
  • 1
    What result are you expecting? Does this function output something to the console, or did you expect a return value to be magically printed? – paddy Dec 19 '13 at 03:57
  • The function takes two matrices as arguments, make same calculations and return a result. I tested it directly on the matlab command line ,it works. But after creating the executable, I can't find how I can pass two matrices as arguments. – user3117667 Dec 19 '13 at 14:22

2 Answers2

0

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.

Community
  • 1
  • 1
user263485
  • 215
  • 3
  • 8
  • I've already created the exe file, the problem is that I can't find how I can pass two matrices as arguments. For two numeric values for example i can use functionname 4 5 but functionname "[1 2 3;4 5 6]" "[1 3 2;7 9 8]) doesn't work – user3117667 Dec 19 '13 at 14:04
0

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().

Wolfgang Kuehn
  • 12,206
  • 2
  • 33
  • 46