[Simulink] How to find different Sample Time blocks

조회 수: 3 (최근 30일)
Moon
Moon 2014년 11월 12일
답변: Orion 2014년 11월 12일
Hello
I am 2012b version user.
on simulink my model, There are two different sample time legens as below (checked using Display- Sample Time - All menu)
(Ammotation - Description - value
D1 - Discrete1 - 0.03
inf - Constant - inf)
My Model is set for discrete simulation. I'd like to find inf constant blocks to make it discrete. However, I checked almost block's sample time setteing manually, but I couldn't find the block which has inf configuration. (All annotation of arrows shows D1- Discrete message)
so, I want to know how to find the block which has the different sample time automatically or manually
Thank you in advance.

답변 (1개)

Orion
Orion 2014년 11월 12일
Hi,
I guess you'd like something like
% get all constant block in the model
AllConstBlocks = find_system(bdroot,'BlockType','Constant');
% loop on all these block
for i = 1:length(AllConstBlocks)
% if the sample time is inf, then display the full path to the block
if strcmp(get_param(AllConstBlocks{i},'SampleTime'),'inf')
disp(AllConstBlocks{i});
end
end
you can adapt this for different kind of block, or other sample times.

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by