Matlab-built application with using rsimsetrtpparam throws error

조회 수: 1 (최근 30일)
AL
AL 2017년 1월 30일
댓글: Alessio Canepa 2017년 3월 22일
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에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by