How to keep SID when using "replace_block"?

1 Ansicht (letzte 30 Tage)
I work with MATLAB R2016b and I cannot make use of keeping the SID when replacing blocks.
I have an old project where we copy the partial models from one model to another with "replace_block".
However, using the 'KeepSID' option, the SID Number will be reset when the "replace_block" is applied.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 4 Jul. 2022
This option is still available but not documented well. You can keep the SID using the following commands:
>> open_system('vdp');
>> get_param('vdp/Mu','BlockType')
ans =
  'Gain'
>> simulinkID = Simulink.ID.getSID('vdp/Mu')
simulinkID =
  'vdp:4'
>> blk = sprintf('simulink/Math\nOperations/Bias');
>> replace_block('vdp','Name','Mu',blk,'KeepSID');
>> get_param('vdp/Mu','BlockType')
ans =
  'Bias'
>> simulinkID = Simulink.ID.getSID('vdp/Mu')
simulinkID =
  'vdp:4'

Weitere Antworten (0)

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by