How to retrieve the output from an executable file generated by MATLAB compiler on the windows command line

9 views (last 30 days)
I have main file containing
function [array1, array2, array3] = myFunction(input1, input2, input3, input4)
% some code
end
I have compiled the main file using the MATLAB compiler to produce an executable file called "mainFile.exe"
On the command line, I call the excutable using the command,
mainFile input1 input2 input3 input4
My question is how do I get the 3 arrays which are supposed to be produced after the application has run. Is there a way to store them into a notepad or csv file?
If further clarification or information is needed, I will add in the comments.
Thank you!

Accepted Answer

Steven Lord
Steven Lord on 25 May 2021
As stated on this documentation page "You cannot return values from your standalone application to the user. The only way to return values from compiled code is to either display it on the screen or store it in a file." The easiest way would probably be to have a section of your program that calls save inside an if statement that checks if the code isdeployed.
if isdeployed
save(nameOfFile, namesOfVariablesToSave)
end
Or if you want them in a human-readable text file see some of the topics in this category in the documentation for MATLAB for alternatives to save for this application.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!