deployment - MATLAB deploytool simulink Undefined function 'load_system' -
i using matlab m file code loads simulink file, runs , evaluats many times inside complicated parallel loop.
it runs perfect @ matlab environment. when compiling code via deploytool command, installing , running command line, have difficult time.
at line loading model,
mymodel= ... ; load_system(mymodel); i following error
c:\program files\mymain\application>warning: name nonexistent or not directory: model > in path @ 109 in addpath @ 86 in run_main @ 3 warning: name nonexistent or not directory: data > in path @ 109 in addpath @ 86 in run_main @ 4 warning: name nonexistent or not directory: graphics > in path @ 109 in addpath @ 86 in run_main @ 5 starting parallel pool (parpool) using 'local' profile ... connected 2 workers. initializing ... undefined function 'load_system' input arguments of type 'char'. error in run_main (line 40) matlab:undefinedfunction i don't care warnings (as don't care of other matlab warnings) error not recognizing function open simulink model ('load_system') :
undefined function 'load_system' input arguments of type 'char'. i did search , found following questions:
the first link says

i got confused: deployment tools compiling c++ or .net ? is supposed increase speed or becomming stand-alone advantage?
the problem both links talk strategy. how implement them? how can compile matlab code uses load_system , sim command load , simulate model?
can bring step step solution simple example of matlab code (m file) simulating model , compiling both of them?
the first sentence of documentation screen shot important one. mentioned @navan (in comment), simulink functionality not compatible matlab compiler. is, m-code uses simulink functinality (load_system, sim, etc) not execute when using matlab compiler.
assuming have access simulink coder, , model doesn't contain functionality prevents being converted c-code, option develop application in 2 parts:
- with simulink model: use simulink coder create executable model. there several examples of doing in doc, including using rsim target batch simulations. there various command line options passing new parameter sets , inputs executable via mat file. results of simulation (i.e written matlab workspace) gets written mat file created executable.
- within matlab code: replace simulink functionality call (typically using
systemfunction, shown in linked example) executable created in step 1. prior call you'll need create mat file parameters in it; , after call you'll want read results mat file created executable.
it's not trivial process, do-able.
Comments
Post a Comment