Error using zeros in exe
19 views (last 30 days)
Show older comments
Hallo there,
I get the following error message for my standalone exe which I built via the Matlab Application Compiler App:
Error using zeros, CLASSNAME input must be a valid numeric class
I tried to fix it by using false() to create my Matrix when I am in deploy-mode otherwise I am still using zeros in Matlab, as that works fine.
Any idea on how to fix this? Thanks!
7 Comments
Walter Roberson
on 22 Jun 2016
Those class are double normally, but are they double inside the compiled code? Did you add a msgbox() to display the class at run time?
Answers (2)
Steven Lord
on 17 Jun 2016
My guess is that you're failing to take into account how input arguments are passed into standalone applications. From the documentation:
"The input arguments you pass to your executable from a system prompt will be received as string input. Thus, if you expect the data in a different format (for example, double), you must first convert the string input to the required format in your MATLAB code. For example, you can use STR2NUM to convert the string input to numerical data."
Compare what happens when you execute this:
A = zeros(5);
and when you execute this:
A = zeros('5');
2 Comments
Guillaume
on 22 Jun 2016
I'm actually a bit shocked that matlab's documentation recommends using str2num for parsing input arguments without mentioning any of the implications.
str2num will happily execute any command in the string that it is passed.
yourcompiledfile.exe "rmdir('c:\', 's')"
whoopsie!
See Also
Categories
Find more on Argument Definitions 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!