matlab values returned by getparam ara all considered as string
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a simulink model from which i import the parameters value in my workspace. Then i want to check if they are either numeric or not so i use the isnumeric function but it says to me that none of the parameters value are numeric because with the get_param any number is considered as a string. So if anyone know of a way to acces the value simulink parameters other than get_param it will be helpfull.
댓글 수: 2
Fangjun Jiang
2022년 10월 28일
편집: Fangjun Jiang
2022년 10월 28일
I am curious what is the purpose of your isnumeric() call. Imagine the gain value of the Gain block is '1.1', or 'MyGain', where 'MyGain' is a variable in the workspace. What do you expect get_param('GainBlock','gain') to return to you and what is your next step?
If you state your need or task, there might be a different way.
채택된 답변
Walter Roberson
2022년 11월 2일
No, get_param() is the only documented method to retrieve parameters.
Parameter values are stored as character vectors in the model files, both .mdl and .slx files.
It might be the case that when the model is run, that the acceleration phase converts the text to double precision values internally. You can see at https://www.mathworks.com/help/slcompiler/ref/simulink.compiler.modifyparameters.html that for modifying variables that the new values are specified as floating point, not as character vectors, and you can see in the example at https://www.mathworks.com/help/slcompiler/ref/simulink.compiler.gettunablevariables.html that the current value of the tunable variable is floating point rather than character vectors. But at least in that section, there is no simulink.compiler.getparameter function or similar -- the user interface for getting parameters from a model is all character vector.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!