get_param(confgset, 'SampleTime') does not return any value...

3 ビュー (過去 30 日間)
Mato
Mato 2024 年 3 月 8 日
編集済み: Mato 2024 年 3 月 9 日
I'm trying to get the value of SampleTime parameter in ConfigSet in my Simulink model.
I set a certain value in seconds in Fixed Sample Time in Solver Detail group of Configuration window,
and then tried to read it in matlab console, such as followings;
>> conf = getActiveConfigSet('MyModel');
>> get_param (conf, 'StartTime')
ans = '0.0'
>> get_param (conf, 'StopTime')
ans = 'inf'
>> get_param (conf, 'SampleTime')
Property 'SampleTime' does not exist.
My question is why get_parameter 'SampleTime' does not work while earlier two, 'StartTime' and 'StopTime', works ok.
Any suggestion related to SampleTime parameter in ConfigSet would be appreciated.
Besides, I don't have Simulink Real-Time package license so that I can't use slrealtime target.

採用された回答

Fangjun Jiang
Fangjun Jiang 2024 年 3 月 8 日
Your lucky guess stopped at three.
It is not called 'SampleTime'. You are probably looking for 'MaxStep'.
Follow this link or open the help document of the model configuration parameter page to find the parameter name under "Programmatic Use"
  1 件のコメント
Mato
Mato 2024 年 3 月 9 日
編集済み: Mato 2024 年 3 月 9 日
Well, I might missed explaining the type of solver is Fixed Type.
As I typed in get_param(.., 'MaxStep') in MATLB console, I got an error.
I used 'FixedStep' instead, then I got correct answer.
Thanks a lot for your advice !!
>> conf = getActiveConfigSet('MyModel');
>> get_param (conf, 'MaxStep')
When 'SolverType' is fixed-step, parameter 'MaxStep' is ignored.
>> get_param (conf, 'FixedStep')
ans = 0.02

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by