Change only one port label without having to rewrite all the mask

3 Ansichten (letzte 30 Tage)
Hello everyone,
I need some help to find a way to change the port label of only one input of a masked system and don't have to rewrite all the maskdisplay.
my boss/teacher want that I design a masked system which will be capable to change dynamically the color of the input port based on the input data choosen by user. My usual way to do that it is by this instruction:
set_param(gcb, 'MaskDisplay', '.....')
which is fair for a number of limited dynamic input port, but for more then 4 it is impossible, because I need to consider all the possible combinations for the input ports. for example for 5 input ports, which can be either red or green I have to write 64 if conditions
red red red red red red red red red green red red red green red red red red green green .........................
set_param(gcb, 'MaskDisplay', 'disp(''ITG_R''), color(''black''), port_label(''input'',1,''\bf{\equiv> In}'',''texmode'',''on''), color(''red''), port_label(''input'',2,''\bf{\equiv> Ti}'',''texmode'', ''on''), color(''black''), port_label(''input'',3,''\bf{\rightarrow Tc}'',''texmode'', ''on''), color(''black''), port_label(''input'',4,''\bf{\rightarrow Tv}'',''texmode'', ''on''), color(''black''), port_label(''input'',5,''\bf{\rightarrow Hlt}'',''texmode'', ''on''), color(''black''), port_label(''input'',6,''\bf{\rightarrow Ul}'',''texmode'', ''on''), color(''black''), port_label(''input'',7,''\bf{\rightarrow Ll}'',''texmode'', ''on''), color(''green''), port_label(''input'',8,''\bf{\rightarrow Per}'',''texmode'', ''on''), color(''red'') port_label(''output'',1,''\bf{Re \equiv>}'',''texmode'', ''on''), color(''black''), port_label(''output'',2,''\bf{Ula \rightarrow}'',''texmode'', ''on''), color(''black''), port_label(''output'',3,''\bf{Lla \rightarrow}'',''texmode'', ''on''), color(''black''), port_label(''output'',4,''\bf{Err \rightarrow}'',''texmode'', ''on'') ')
So to modify just a label of a port I have to rewrite all the maskdisplay or there is another way
thanks in advance

Akzeptierte Antwort

grapevine
grapevine am 9 Mär. 2012
I found a way
set_param(gcb, 'MaskDisplay',strrep(get_param(gcb, 'MaskDisplay'), 'color(''black''), port_label(''output'',1,''=','color(''red''), port_label(''output'',1,''='))

Weitere Antworten (0)

Kategorien

Mehr zu General Applications finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by