RefModificationViolation when changing submodel

I am getting this error:
??? Error using delete
Attempt to modify block in a linked subsystem. This can only be done by the block or its parent through their mask initialization code
When I try to do the following:
b1 = add_block('built-in/SubSystem',blockName);
set_param(b1, **********);
if ishandle(b1)
delete_block(b1);
end
What could it be?
I have checked and doulbechecked the paths and they all are right, the model is working fine is being loaded fine too, I can not disclose more information because I really do not understand what is going on.

Answers (0)

Categories

Products

Release

R2017a

Asked:

on 30 Oct 2020

Community Treasure Hunt

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

Start Hunting!