Bus selector cannot find signals where the name has been changed programmatically?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I programmatically need to change signal names in simulink. I use a code similar to:
lineH = find_system(gcs, 'FindAll', 'on', 'type', 'line');
set(lineH, 'Name', 'NewName');
So far so good, but when the changed signal is fed into a bus and should then be selected with a bus selector block, the selector block does not find the "NewName".
I would need to manually open the bus selector block and select the "NewName". Problem is, that there are hundrets of signals to be changed and even much more bus selectors, where the change needs then to be done manually.
Interresting is, that if a signal name change in Simulink is done manually, the bus selectors are somehow updated and the "NewName" is detected automatically without the need of selecting the signal in the respective bus selectors.
Has anyone a solution for this problem? It would be nice, if there was a built in matlab/simulink function that can automatically update all bus selectors after a programmatically performed signal name change?
Thanks for you help. Thomas
2 comentarios
Joe Rustan
el 25 de Oct. de 2022
I'm facing the exact same problem in Matlab 2019, 2020 and 2021. I can type in a new signal label name and the Bus Selector immediately updates the name at the outport. However, if I try doing it programmatically, this update does not happen and I have to manual remove and re-assign the new name in the Bus Selector.
Any help would be appreciated, thanks.
Prabhakar
Ravindra Goyal
el 22 de Ag. de 2024
I am also wondering, as I have also the exact same problem (Matlab 2022b)...!
Respuestas (1)
Shubham
el 24 de Ag. de 2024
Hey Thomas,
The bus selector block is not able to find the signals whose names have been changed programmatically because the Bus Selector Block treats the input signals as a read only object.
I have attached a very simple model and I was trying to reproduce the issue. I found that I was unable to change the signal label programmatically in the case of Bus selector block. I had tried the code snippet provided by you and I have recieved the following error message: "Cannot change the signal label of a line connecting a Bus Selector."
Alternatively I have tried setting the parameter values of the Bus Selector Block by referring to the following MATLAB Answer:
I have used the following code snippet:
bus_selector_info = find_system(bdroot, 'BlockType','BusSelector');
set_param(bus_selector_info{1}, 'InputSignals','t');
But this has resulted in a different error message: "BusSelector block parameter 'InputSignals' is read-only."
Since the 'Input Signals' parameter is read only, we cannot modify the signal name programmatically. The modification needs to be done manually in this case.
I hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Sources 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!