Rename Signals in Simulink with MATLAB

조회 수: 20 (최근 30일)
Carsten
Carsten 2011년 10월 26일
이동: DGM 2023년 7월 4일
Hello,
is it possible to trigger the command in Simulink "double left click on line -> rename line" from MATLAB?
The command
set_param(OBJ,'OutputSignalNames','test')
isn't possible, because the parameter is read only (btw. i do not understand why). I'm not able to change the name of the line directly (e.g. with setname, handles...)
To avoid problems during run or compilation time i used the "PreSaveFct" to call the m-file.
I could open the mdl-file as a text file and change the names directly. But this isn't convenient.
thanks for the help!
Carsten
  댓글 수: 1
Carsten
Carsten 2011년 11월 2일
i can't believe that this isn't supported! :(

댓글을 달려면 로그인하십시오.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 11월 2일
It can be done. You just need to get the handle of the signal line.
There are many ways to get the handle of the signal line. In this example, assume the block has one outport.
PortHandles=get_param(gcb,'PortHandles');
set_param(PortHandles.Outport(1),'Name','NewSignal');

카테고리

Help CenterFile Exchange에서 Prepare Model Inputs and Outputs에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by