Code covered by the BSD License  

Highlights from
Add Simulink Blocks from a given Model File with context menu

5.0

5.0 | 2 ratings Rate this file 10 Downloads (last 30 days) File Size: 8.71 KB File ID: #30248
image thumbnail

Add Simulink Blocks from a given Model File with context menu

by Paul

 

31 Jan 2011

Customizes Simulink context menu with all blocks from a model file custom_context_menu_blocks.mdl.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

Customizes Simulink context menu with all blocks from a model file custom_context_menu_blocks.mdl.
These blocks are accessible through context menu: Add custom block / List of blocks. The chosen block is added at the position of the mouse click that initiated the context menu.

Please feel free to modify custom_context_menu_blocks.mdl to meet your expectations and needs.

It might be neccessary to run sl_refresh_customizations command to refresh Simulink context menu or set the Matlab path correctly.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Create From Blocks

Required Products Simulink
MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
26 Mar 2011 Lukas Lansky

Very useful.

21 May 2012 Igor Braverman

As of R2012a there seems to be a little bug (typo)--> userdata became case sensitive or they have changed it on you.
old sl_customization reads:
----------------------------
66 customMDL = inArgs.Userdata{1};
67 blockName = inArgs.Userdata{2};
68 mousePosition = inArgs.Userdata{3};
---------------------------
need to read:
---------------------------
customMDL = inArgs.userdata{1};
blockName = inArgs.userdata{2};
mousePosition = inArgs.userdata{3};
---------------------------
Sincerely,
Igor

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
simulink Paul 31 Jan 2011 20:27:31
context menu Paul 31 Jan 2011 20:27:31
sl_customization Paul 31 Jan 2011 20:27:31
custom menu Paul 31 Jan 2011 20:27:31
add block Paul 31 Jan 2011 20:27:31
model Paul 31 Jan 2011 20:27:31
potw Lindsay Coutinho 22 Jul 2011 10:37:59
pick of the week Lindsay Coutinho 22 Jul 2011 10:37:59

Contact us at files@mathworks.com