I want to add blocks to MATLAB simulink model by command line. I used add_block command to add a Constant block to my model by following command and it worked
add_block('simulink/Sources/Constant','MyModel/ConstValue')
But when I try to add'Chart' to my model by the following command,
add_block('stateflow/Chart','MyModel/Chart')
It causes an error:
Error due to multiple causes.
Caused by:
Unable to load block diagram 'stateflow'
There is no block named 'stateflow/Chart'
How should I sove this prblem ?
Solution ref: https://uk.mathworks.com/matlabcentral/answers/53920-how-to-add-a-stateflow-chart-in-an-existing-simulink-model-using-api
The source you need is sflib/Chart
not stateflow/Chart
So the command is something like:
add_block('sflib/Chart','MyModel/Chart')