Why can't I find a 'Stateflow.EMChart' behind a masked library block?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 8 Dec 2022
Answered: MathWorks Support Team
on 26 Jan 2023
I have a model and a custom library. The custom library contains a masked subsystem, within which is a 'MATLAB Function Block'. I have placed an instance of the masked subsystem into my main model.
Before I moved the masked subsystem into the library, I used the following command to get the 'MATLAB Function Block' as a 'Stateflow.EMChart':
block = find(get_param(block_name, "Object"), '-isa', 'Stateflow.EMChart');
But now that I am using the masked subsystem as a library block, the above command returns an empty cell array. To get a value again, I have to first call
set_param(gcb,'LinkStatus','none');
to disable the masked subsystem's library link.
Disabling the library link is not ideal. Is there a way I can find the 'Stateflow.EMChart' without disabling the link?
Accepted Answer
MathWorks Support Team
on 8 Dec 2022
Disabling the link status of the library block is the only way to access the 'Stateflow.EMChart' of the 'MATLAB Function Block' with this configuration of blocks.
In general, accessing a 'Stateflow.EMChart' behind a mask is not a recommended practice as it goes against model-based-design principles. Instead, it is recommended to use 'Variant Systems' to accomplish the behavior you have described.
You can learn more about 'Variant Systems' at the link below:
0 Comments
More Answers (0)
See Also
Categories
Find more on Subsystems 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!