Is there a simple way to change sampling rate of multiple blocks in Simulink?

4 ビュー (過去 30 日間)
legendbb
legendbb 2014 年 2 月 24 日
コメント済み: legendbb 2014 年 2 月 24 日
Dear Experts,
Just wondering if there is a simple way to change sampling rate of multiple blocks?
Or if there is a programmatic way of list out all blocks inside a model, and use list assignment to change sampling rate?
Please comment,
Thanks,

採用された回答

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy 2014 年 2 月 24 日
Please see the functions find_system to list blocks within your model. You will need to know the name of the parameter for sample time, but for built-in blocks, it is SampleTime. You can then set
set_param(gcb, 'SampleTime', '0.001')
for each block.

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 24 日
ts=0.0001 % your sample time
s=find_system('untitled')
for k=2:numel(s)
m=s{k}
try
b=get_param(m,'sample time');
set_param(m,'sample time',num2str(ts))
catch
end
end

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by