Problem with name of simulink model slTuner

17 次查看(过去 30 天)
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
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.

Community Treasure Hunt

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

Start Hunting!

Translated by