Matlab-built application with using rsimsetrtpparam throws error

1 次查看(过去 30 天)
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 个评论
AL
AL 2017-1-31
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?

请先登录,再进行评论。

采纳的回答

AL
AL 2017-1-31
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 个评论
Alessio Canepa
Alessio Canepa 2017-3-22
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by