Rename Signals in Simulink with MATLAB

13 visualizaciones (últimos 30 días)
Carsten
Carsten el 26 de Oct. de 2011
Movida: DGM el 4 de Jul. de 2023
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 comentario
Carsten
Carsten el 2 de Nov. de 2011
i can't believe that this isn't supported! :(

Iniciar sesión para comentar.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 2 de Nov. de 2011
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');

Categorías

Más información sobre Prepare Model Inputs and Outputs en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by