Filter löschen
Filter löschen

Matlab-built application with using rsimsetrtpparam throws error

1 Ansicht (letzte 30 Tage)
AL
AL am 30 Jan. 2017
Kommentiert: Alessio Canepa am 22 Mär. 2017
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 Kommentar
AL
AL am 31 Jan. 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?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

AL
AL am 31 Jan. 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 Kommentar
Alessio Canepa
Alessio Canepa am 22 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by