Use sub-function inside of an .exe file (generated by matlab)

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
Ilias Seferlis
Ilias Seferlis il 27 Dic 2017
you are right. Do you have any idea how I can make this work? Is it even possible? Thanks!
Walter Roberson
Walter Roberson il 28 Dic 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 ?

Accedi per commentare.

Risposte (1)

Matt J
Matt J il 27 Dic 2017
Modificato: Matt J il 28 Dic 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.

Categorie

Scopri di più su MATLAB Compiler in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by