How can I Programmatically add CAN Pack block to a Simulink Model?

9 views (last 30 days)
I trying to add CAN Pack block to simulink model using matlab commands Can you please help me

Accepted Answer

Sebastian Castro
Sebastian Castro on 17 Apr 2017
Edited: Sebastian Castro on 17 Apr 2017
If you open the source block library for the CAN Pack block, select the block, and then type gcb at the MATLAB Command Window, you'll see the name of the block to work with it programmatically.
I did it with my Vehicle Network Toolbox library and got the following. Note that there are other CAN Pack blocks in other toolboxes, so depends on which you are using.
'canlib/CAN Pack'
So you can take that and add it to your model with add_block as follows
add_block('canlib/CAN Pack','my_model/my_block_name');
Sebastian

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!