Question

Following this answer : https://stackoverflow.com/a/8988568/1357553 , regarding how to pass command line arguments to an EXE generated by Matlab Compiler, I would like to know how to receive the results returned by the function after all calculations

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top