Matlab-built application with using rsimsetrtpparam throws error

1 visualizzazione (ultimi 30 giorni)
Hey there, I am struggling with a problem thrown by my built Matlab-Application.
In short, what I am trying to do with the .exe:
  • Aim: load and calculate Parameters, then write .mat-Parameterfile for a compiled Simulink-Application. Similar to: openExample('simulinkcoder/UseRSimTargetForBatchSimulationsExample')
So, more detailed:
  • Matlab-App reads some parameters from file (works)
  • Matlab-App calculates some stuff with these parameters (works)
  • Matlab-App loads a working RTP-Parameterfile. Then it should add the parameters using rsimsetrtpparam() and afterwards saving the new parameterfile (as .mat). ( does not work)
The error is thrown when executing the .exe in the command line:
Undefined function or variable 'sl'.
Error in rsimsetrtpparam (line 43)
...
MATLAB:UndefinedFunction
But the pop-up error message box says another / additional error:
Undefined function 'sl' for input arguments of type 'struct'. Error in => MyApp.m at line xy
I already tried to include the 'sl'-function from MATLAB\R16b\toolbox\simulink\simulink\sl.m in the "Files required to run your Application" in the Matlab Application builder, but the error remains.
So what might solve this problem? Is there a problem using structs in built Matlab-Applications?
Appreciating every kind of help,
AL
edit: the code works well when running in matlab, but even not if built.
  1 Commento
AL
AL il 31 Gen 2017
Well, I am now so far that I think this problem might be related to the simulink/private function 'modifyRTP'. This function is being called by rsimsetrtpparam.
Might it be that these simulink/private functions are not supported for Code Generation?

Accedi per commentare.

Risposta accettata

AL
AL il 31 Gen 2017
So I finally got it solved by diving into the Matlab-Directories.
All depends on the modifyRTP.p , located in toolbox/simulink/simulink/private. You have to add this file to "Files required for your application to run" in the Matlab Compiler UI, as well as the file "sl.m". Then it all works.
  1 Commento
Alessio Canepa
Alessio Canepa il 22 Mar 2017
Good job AL! I confirm your solution works. I add that it could also happen that you don't get any error, but the application simply gets stuck. Your solution works also in this case.

Accedi per commentare.

Più risposte (0)

Categorie

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

Community Treasure Hunt

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

Start Hunting!

Translated by