compile MatLab into standalone exe, how to pass matrices as input.
6 views (last 30 days)
Show older comments
Hi,
I compiled my MatLab model into a standalone exe, I am looking for ways to pass matrices as input. According to the compiler documentation -> passing arguments to and from a standalone application, it mentioned that argument from command line is considered as string input, therefore we need to adjust MatLab model to be aware of that. It also showed example to convert string to double. But how about matrices/vectors? If my function accepts input as matrices, how do I pass it from command line? Thanks!
0 Comments
Accepted Answer
dpb
on 9 Jan 2019
"[A]rguments can be passed to standalone applications created using MATLAB® Compiler™ in the same way that input arguments are passed to any console-based application"
This means the application doesn't get an array but the string representation of the array and there's no connection to command line arguments to ML variables excepting by writing code to parse those arguments and place the result in the proper variable.
Sad, but true; when an app is compiled, it becomes just like any other console application; all the interaction with Matlab and the command window and variables known in Matlab when the compiled app is dispatched are simply not there between the two any longer...all the app has access to is the text on the command line to retrieve and do with what it will.
For anything but the most trivial of inputs, it's probably better to use a file for the purpose.
3 Comments
dpb
on 9 Jan 2019
Edited: dpb
on 10 Jan 2019
I dunno much about the DLL interface route, sorry.
If you were to write a .mex function, it could be called like any other Matlab function and be passed any of the base ML datatypes -- I've not checked recently whether the API has been extended to a bunch of the more recent and exotic new datatypes/classes or not, but certainly arrays of double and the like...
More Answers (0)
See Also
Categories
Find more on Deploy to C++ Applications Using mwArray API (C++03) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!