Increment goto name in Simulink

조회 수: 4 (최근 30일)
Steven Dumoulin
Steven Dumoulin 2019년 2월 20일
답변: Dhanashree Mohite 2019년 2월 26일
I am working in a simulink model where I need to make a lot of Goto and From blocks.
The goto blocks can have the same name, but the last number need to be incremented.
Is there any fast way to make this blocks, without needing to change the name every time?
Also when a signal comes out of a Bus selector, Can a goto label have the name of the signal, coming out of the Bus Selector.
gotoIncrement.png
gotoBusSelector.png

답변 (1개)

Dhanashree Mohite
Dhanashree Mohite 2019년 2월 26일
You can do it programmatically through add_block and set_param, as per my understanding. Please refer the following example.
sys = 'Sample'; % model is Sample.slx
open_system(sys) % Open the model
for i=1:5
h = add_block('simulink/Signal Routing/From',[sys '/From'],'MakeNameUnique','on');
set_param(h,'Gototag',strcat('goto',num2str(i)));
end
Similarly you can create multiple GoTo blocks as well. The 'Position' parameter can be used for mentioning the position in model for each block in model window.
Yes, a goto label can have the name of the signal, coming out of the Bus Selector.

카테고리

Help CenterFile Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

태그

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by