Peculiar behavior in compiled standalone
1 view (last 30 days)
Show older comments
Hi there
Just working through the motions of compiled code that throws an inexplicable error. The *.m "raw" file seems to work fine, but the compiled version (suing application compiler) throws the error "left and right sides have different number of elements" precisely at a function call, e.g. function [a,b] = myFun(x,y,z). Have gone through every single line of code, every combination of inputs, the *.m file works flawlessly but the compiled version blows up.
Looked at dependencies, linted the code, checked variable types, structure, DLLs and other ancilliary functions called, nothing works. The surprising issue is that all the outputs are defined or properly initialized. The *.m file works, as said. Took the function outside (as a separate *.m file) and nothing. Bundled it inside the main code, didn't help either.
Injected specific messages at specific places within the function (to see if it blew before or after any of them, once called) but the function refuses to run on its entry point (when it throws the error).
Any ideas?
0 Comments
Answers (1)
Steven Lord
on 24 Aug 2021
Is the function in the standalone application that throws an error operating on one or more of the input arguments with which the standalone application is called? If so see "Using a MATLAB File You Plan to Deploy" on this documentation page.
You may think you're passing in a number, but you're actually passing in a char array.
x = 10
size(x)
y = '10'
size(y)
2 Comments
See Also
Categories
Find more on Environment and Settings 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!