Removing path name from Simulink block name
Show older comments
Hello,
I'm working with a block replacement command for a large subsystem and I'm running into issues with the block naming.
I've created a sample subsystem Simulink model to illustrate.
When I run the command below, I create a list of all gain blocks in my model.
gain_blocks = getfullname(Simulink.findBlocksOfType('trial_model','Gain'));
To replace the blocks with another Simulink primitive library that's approved by the company standards, I use the command below and loop through all the instances of the Gain blocks
replace_block('trial_model','Name',gain_blocks(i),'do178Lib/Simulink/Math Operations/Gain');
The third arguement of the replace_block does not seem to support the full path of the Simulink blocks but rather their shortened names. Is there a quick way of stripping the path of each block from the string? Ideally, this would have to work and be adaptable for multi-level subsystems in Simulink.
Accepted Answer
More Answers (0)
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!