Problem with name of simulink model slTuner

Dear forum members,
I would like to use slTuner to tune control gains of Simulink models.
The simulations are stored in "+slxFiles/model.slx".
The name of the model is stored in a variable :
mdlName = '+slxFiles/model.slx';
When I try to open the simulink file this way, everything works fine :
open(mdlName);
But the problem occurs when I call the slTuner function :
slTuner(mdlName,TunedBlocks);
Error using slLinearizer (line 193)
'+slxFiles' is not a valid model name because it is not a valid MATLAB function name.
Why does slTuner cut the name after the "/" ? How can I solve this issue ?
Thanks in advance !

답변 (1개)

Guillaume
Guillaume 2023년 9월 14일

0 개 추천

Hello,
Old issue but might help someone some day...
Speaking about file path '+slxFiles/model.slx' is correct.
But all functions that requires a model name (open_system, slbuild, get_param...) just want the model name, no path, no extension.
In order to open a Simulink model you should use open_system instead of open.
In your case, modelName = 'model'. And the model file has to be in the Matlab Path or in the pwd.

질문:

CN.
2022년 1월 19일

답변:

2023년 9월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by