Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

add-block command in MATLAB

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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 :

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')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading