Problem with name of simulink model slTuner
22 views (last 30 days)
Show older comments
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 !
0 Comments
Answers (1)
Guillaume
on 14 Sep 2023
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.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!