按照这个答案:https ://stackoverflow.com/a/8988568/1357553 ,关于如何将命令行参数传递给由Matlab编译器生成的EXE,我想知道如何在所有计算后接收函数返回的结果
1 回答
I can see 3 methods:
Save the results to a file.
Print the results to the terminal, either to stdout or to stderr, using
fprintf(1, ...)
orfprintf(2, ...)
.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.