Use sub-function inside of an .exe file (generated by matlab)
2 views (last 30 days)
Show older comments
I want to convert a script main.m,which uses a sub-function,into a standalone main.exe file. I tried using nested function inside the script but it doesn't work.The sub-function is being used multiple times during execution and it is quite large.Is there any way I can make this work? Maybe convert both script and sub-function into two exe files and make one call the other?
% script main.m %
. . .
Y1 = PolyApprox(S_initial1,S1,flag1,bound1);
Y2 = PolyApprox(S_initial1,S2,flag2,bound2);
. . .
% End of script %
system('main.exe') % run exe
4 Comments
Walter Roberson
on 28 Dec 2017
Why not convert your script to a function? Especially considering that you plan to compile it, you surely cannot be counting on it changing variables in whatever workspace it happens to be executing in ?
Answers (1)
Matt J
on 27 Dec 2017
Edited: Matt J
on 28 Dec 2017
If your "script" really is a script (i.e., no function line header), then I'm not sure the Matlab Compiler will accept that as your main file. If you convert main.m to an actual M-function file, there's no reason why a sub-function should present problems.
0 Comments
See Also
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!