Code covered by the BSD License  

Highlights from
AutoSizeOnConnect

Be the first to rate this file! 7 Downloads (last 30 days) File Size: 15.31 KB File ID: #31576
image thumbnail

AutoSizeOnConnect

by Mike Anthony

 

25 May 2011 (Updated 16 Jun 2011)

Automatically resizes the number of ports on a block for automatic connection.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

In many cases, Simulink® users have multiple blocks that they wish to connect to a block, particularly mux, demux, and bus creator blocks. The current practice is to drag one of these blocks from the Simulink library browser into the model. The mux block, for example, by default has 2 input ports. If you have 4 blocks that you wish to connect, you must open the mask of the mux block and set the number of inputs to 4. This will then create 4 input ports on the mux block. The user can then select the 4 blocks he/she wishes to connect to the mux block, hold CTRL, and select the mux block to automatically connect all of the blocks.

This function eliminates the manual step of opening the mask and setting the number of desired inports/outports and does that automatically based on the number of blocks the user selected to try to connect.

Open the included Simulink model AutoSizeOnConnect.mdl and follow the instructions therein to see an example of how to use this function.

This functional is especially useful when used in conjunction with AutoSize, which is included in this submission but can also be downloaded separately (see Acknowledgements below).

Required Products Simulink
MATLAB release MATLAB 7.12 (2011a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
27 May 2011

Updated references, updated screenshot, and fixed minor typos in the files.

03 Jun 2011

added acknowledgement reference.

16 Jun 2011

Updated AutoSizeOnConnect.m to handle Multiple Input blocks with 'NumInputs' property (like the VectorConcatenate block)

Tag Activity for this File
Tag Applied By Date/Time
modeling Mike Anthony 27 May 2011 10:58:43
gui Mike Anthony 27 May 2011 10:58:43
simulink Mike Anthony 27 May 2011 10:58:43
autoconnect Mike Anthony 27 May 2011 10:58:43

Contact us at files@mathworks.com