MATLAB Answers

How to write my Matlab code so that its standalone application program takes multiple input files?

4 views (last 30 days)
Benson Gou
Benson Gou on 17 Jun 2020
Commented: Benson Gou on 18 Jun 2020
Dear All,
I want to design my standalone application code (.exe file generated by Matlab compiler) which takes input files as follows:
> Standalone_Code.exe <file1> <file2> <file3> <file4>
I am wondering if it is possible to write my Matlab code so that I can run its standalone applicaton code as the above.
Thanks a lot.


Sign in to comment.

Accepted Answer

Matt J
Matt J on 17 Jun 2020
Edited: Matt J on 17 Jun 2020
It should work just as you've shown. Just write your mcode to accept input arguments as you would write a non-deployed mfile. See also,


Benson Gou
Benson Gou on 18 Jun 2020
Hi, Matt,
I wrote my Matlab code for the input files as follows:
fundction [x] = main(file1,file2,file3,file4)
I have 4 txt files and their names are 'model.txt', 'meas1.txt', 'meas2.txt','meas3.txt'. I run my Matoab code as follows,
>> [x] = main('model.txt', 'meas1.txt', 'meas2.txt','meas3.txt')
it worked perfectly.
But after I obtained my standalone application using Compiler, I tried the following ways to read the input files:
  1. > main('model.txt', 'meas1.txt', 'meas2.txt','meas3.txt')
  2. > main 'model.txt', 'meas1.txt', 'meas2.txt','meas3.txt'
  3. > main <'model.txt'> <'meas1.txt>' <'meas2.txt'> <'meas3.txt'>
All of them did not work. Would you please tell me how it would work? Thanks a lot.

Sign in to comment.

More Answers (0)

Translated by