1

按照这个答案:https ://stackoverflow.com/a/8988568/1357553 ,关于如何将命令行参数传递给由Matlab编译器生成的EXE,我想知道如何在所有计算后接收函数返回的结果

4

1 回答 1

1

I can see 3 methods:

  1. Save the results to a file.

  2. Print the results to the terminal, either to stdout or to stderr, using fprintf(1, ...) or fprintf(2, ...).

  3. Return an exit code with exit(code). This might work if you just want to return an integer.

Solution 2 and 3 might only work on linux. This website has some more info about passing data into and out of the command line. I am not sure if this also works for compiled code, I do not have the Matlab compiler. It depends a bit on the type of data that you want to return. For anything more complex than a simple number, solution 1 is probably the best way.

于 2013-10-10T18:18:57.807 回答