If I am not in a meeting, I am generally at my desk. I often spend the whole day in front of a computer. Because so much of my time is spent with a hand on the keyboard, I look for all those tricks that make my work more efficient. I could tell you about the way I have customized my Windows environment, but this is a Simulink blog, so let me tell you how I build models faster.
Tip: Collect, and then connect. When building a diagram, collect all the blocks you think you need, and then connect them together. Dragging most of the blocks you need from the library onto the canvas gives you a chance to pre-organize you diagram. As you start connecting the blocks, you can focus on how to lay things out to make it easy to understand. Remember, collect, and then connect.
Collect blocks on the canvas.
Connect them together to form the equations for your system.
Tip: Use Control-Click to connect blocks. Most everyone has seen this dialog in Simulink:
This showed up in R13 Simulink around 2002 when the Ctrl-Click method for connecting blocks debuted. Connecting from one output to one input is the obvious application. The more efficient methods of using this involve connecting many blocks to one block in a single click. I use this when I have to wire many blocks to a bus. For example, think of connecting many blocks to one.
First, select the many blocks using a drag select or shift select each block.
Next, Ctrl-Click on the one block you want to connect all of these to, simultaneously.
This also works to connect from many sources to a single destination. Remember; select the many, then Ctrl-select the one.
Now it’s your turn
Now you have a couple of the accelerators I use when building models. What do you do? Leave a comment here and share your workflow accelerators with the rest of the Simulink community.
34 CommentsOldest to Newest
nice to hear on your use of workflow accelerators. I agree with them.
My biggest accelerator is using mouse and keyboard in conjunction. for example: using the shift key and scroll in order to pan horizontally.
When it commes to this I have one suggestion: please implement the control-scroll option: zooming in and out, as in most office suites. Now ctrl-scroll is the same as shift-scroll, and hence doesn’t add anything.
@Han Geerligs – You brought another good two handed acceleration (In addition to Ctrl-click). I agree, it would be great to have a scroll option for zoom in/out. I have passed this idea over to our developers.
I use the same methods described above to speed things up, but here are a couple of tricks that weren’t mentioned…
Q. How do you disconnect a block without deleting it or the lines that connect to it?
A. Hold shift before you select and drag a block it will disconnect rather than dragging the lines with it. This also works for groups of blocks (any connections between blocks that have been selected are dragged with the group). This is very useful if you want to replace a block without copying or deleting it.
Imagine you’ve laid out a complicated connection path that feeds into lots of blocks (subsystems, scopes, displays, etc.) and you want to insert a block near the beginning of the path without deleting all the routing you’ve already laid down.
Q. How do you break an existing line (e.g. between two connected blocks) without deleting it?
A. If a block has only one input and one output then when you drag it and release over a line Simulink will automatically break the line and reconnect it properly either side of the new block. Therefore, just grab any old SISO block (e.g. a Gain block) and drop it onto the line where you want to break it, then delete it. I often copy (right-click drag) a Gain from somewhere else in the model to save me opening the library browser.
@Phil – Shift-click to disconnect blocks is a great accelerator I use all the time. I hadn’t thought about the breaking an existing line trick using a SISO block. GREAT suggestion!
To Phil/Seth: When does one desire to breake, but not delete a connecting line? What about replace a block instead?
@wei – Placing a surgical snip in a line is helpful if the diagram is complicated, or work has been put into making the line routing look a certain way. Any time I have taken time to lay out many signals, routing them carefully in a crowded section of the diagram, or providing carefully placed branches I can see the benefit of doing what Phil suggested.
Wei in Comment 5 asked when you’d need to break a line, why not just delete and replace a block, or just choose the block you want to insert and drop it onto the line.
Sometimes you want to insert a block that has multiple inputs or outputs (e.g. a Product block has two inputs) but the automatic insert only works for SISO blocks; that’s when the trick I mentioned becomes useful.
I also agree with Seth about the ‘surgical’ nature of the routing; I have had very many hideously complicated models that have been made easier to understand by careful and well planned routing (especially when muxing isn’t appropriate).
Often a bunch of lines will all route around the model following the same path, and another technique that often gets overlooked is to drag-select all the lines and use the arrow-keys to adjust them. This is better than moving each one in turn with the mouse. However, it does get complicated when there are branches further upstream because they get moved too.
I like shortcuts, so I often use them to help me
– toggle the grid e.g. set_param(gcs,’showgrid’,’on’);
– print the current model to pdf e.g. print -s -dpdf;
– automatically adjust block size
Another great feature is the Annotation ClickFcn which allows you to implement other useful gadgets.
*** Question ***
Does anyone know how to customize the simulink *.mdl template. Let’s say I always want to have a DOC- or ModelInfo-block within my model, how can I accomplish this?
There are quite a few handy Simulink short cut keys available…
Here they are listed in the Doc.
Some of my favorites that I use all the time (check out what they do on the link above!):
p or q plus mouse move
As an aside… Note you can pass doc locations to your peers by using the View/Location option on the help browser. A screenshot is below. It handily returns the web address and the command string to get right to that doc page!
To be precise… I was talking about toolbar shortcuts, which can be added programmatically. (For instance I included our CTI assistant into Matlab – so I don’t have to dial numbers on my VOIP phone)
@impf – very cool! CTI (Computer Telephony Integration) from MATLAB must be very convenient. I’m sure the Desktop Team would love to hear more about how you have customized your desktop.
We’re glad you find the shortcuts useful. In case you weren’t aware you can set the icon to be a Simulink icon instead of the MATLAB membrane to differentiate your tasks.
Also in response to your question,
Rather that customize the model template, I’ve created a function that uses the model construction commands to set it up. Usually some inports and outports, setting the solver to fixed-step, target to ERT, etc. And I just scanned the doc and it seems we have have a manual page about this: Simulink->Creating a Model->Creating an Empty Model->Creating a Model Template
Mike, from the Desktop team.
Hi Dan Lluch, There is just one problem with View/Page Location. The location is not version specific! I may be a few versions behind from the current release.
I have asked before: how do I get to older docuementation from the mathworks website?
To Phil: You can even disconnect a block from a line without deleting it by using both mouse buttons simultaneously to select and drag it. This is something I use all the time.
Another a few more great little tools are the extra options you get when you right-click on multiple selected blocks. New menus ‘Align blocks’, ‘Distribute Blocks’ and ‘Resize Blocks’ are now available. Try them out!
Are there keyboard shortcuts for jumping between simulink/matlab windows? for example, to bring up the library browser, or to go straight to the command window? cycling through Alt-tab can be inconvenient, and sifting through with the mouse is very slow… Any tips?
@Tyler – We don’t currently provide a way to jump between MATLAB, your Simulink model, and the library browser. I have added your name to the list of people who also asked for this capability. Thanks!
Subject: Matlab: Slowness of R2008a
Are there any other Simulink model users that have noticed a big difference in speed between R2007a and R2008a (and b)? Several users (Windows XP) noticed a few things:
1) The first time a open a .mdl file in R2008a, it takes a few minutes to
load, compared to a few seconds in R2007a.
2) Every so often (randomly it seems) Simulink “hangs up” when I click on a model block to open it. This could be a constant block, a switch, gain, or anything else. I double click and the whole program just stalls for about a
minute or so before the desired window pops up. This never happened to me with R2007a.
3) Model execution seems to take longer, but not orders of magnitude like the other issues listed above.
In the given targetlink model, I have to check
“No disconnections in port?” in MATLAB 7.3(R2006b)
Can you suggest me how to implement using API
if u can then plz tell me how to use simulink for voice recognisation or analysis?
I am wondering if there is any way to “copy multiple blocks with their connections” into an existing Simulink system programmatically. The API does provide some functions which might be usable here, e.g. Simulink.SubSystem.copyContentsToBlockDiagram(A,B); but for that the block diagram has to be empty, similarly there is a vice versa function as well with the same restriction.
Many thanks in advance.
Hello, I am having the age old problem of port synchronization in
Simulink. I have created a simulink model to simulate error correction
by Hamming codes but even with out any channel noise, I am getting
error. Would you like to try it out and find a possible solution
I have the simulink model uploaded at edaboard.com (http://
http://www.edaboard.com/viewtopic.php?t=341926&highlight=) since I dont know how to upload it here. But you can contact me via my email address, I’ll send you the model. But please help me as it is really holding me back in terms of Simulation and the use of Simulink for that matter
So have you found a better way to solve it. I tried the buffer thing. I used a buffer prior to Hamming code to make the length equal to 4 bits and fed it to Hamming encoder. After Hamming encoder the output is 7 bits. Now since I want to use interleaver 7 bits are not enough so I used another buffer to concatenate it till 200 bits. The problem is that I can’t decode it after de-interleaving. I always get an error even without any noise.
I know this problem is due to “Alignment” and “Delays” but honestly speaking I dont find Simulink tutorial in Matlab help too helpful. I hope you have solved the problem and are willing to share the solution.
Please share this solution. I’m expecting a quick reply
can i know your personal email id Mr.Seth
Good morning all,
i have this model which has
a)bernoulli binary generator
e)multipath fading channel and AWGN channel
f)Deinterleaver and BUffer
h)Error rate calculation
i want to plot the ber for the above model with interleaving,my problem is that my input signal width is 10000×1. we know that matrix interleaver dimensions product should be equal to 10000. but i want to use buffers. can you tell me how can we do this? very urgent because i have to submit my thesis within a week.
sir i wanted to know the block diagram of bernoulli map using simulink……
nice work !
Is there a way to Disable/Hide the close button (‘X’) of the Simulink model window?
Hi, It will be great to have an automatic clean-up / Arrange elements tool like in Labview. While updating the model everytime, we are making the model messy… we are facing problems like…More crossing lines / signals… The elements are not in order…
Even the model works, the reviewer is having hard time due to this. So it is great to have a button, clicking it shall arrange all the elements in order and reduces the crossing lines / signals by moving the elements inteligently.. It will be more good if the button allows us to apply this only to selected portion of the model…
Hi Seth (and also Guy),
I was wondering what has happened with my suggestion to use ctrl-scroll for zooming in/out?
Is it being considered to appear in the next release r2012a?
Hi Han. As part of the major ongoing effort to revamp the Simulink and Stateflow editors, panning and zooming controls have undergone quite a transformation. Your suggestion is right in line with what we are planning. In fact, by default the scroll wheel will zoom instead of scroll. It is, however, controlled by a preference which will allow you to do exactly what you describe.
This work is tied to a larger effort that is not going to be available in R2012a.
thanks for the prompt answer. I am happy MathWorks is working on the editors. I think it will be very beneficial to “unify” the Stateflow and Simulink diagram editors.
pls gige more applications and advantages of MATLAB-SIMULINK.
I want to know, how to copy targetlink/simulink block without having link to original block or library, everytime I copy blocks, I will have to disable and break links :(
I am not sure whether this question can be answered on this thread or not. But, I would like to know if there is a way to copy blocks/subsystems between two separate models?
Hi Seth, your blog is quit helpful for my use of simulink, thanks!
i found when i right click the signal line, i can create a “create & connect viewer – simulink – scope”, it is like a line-attached scope, and more convenient and tidy than the commonly “scope” block in default library.
is there a shortcuts or hotkeys for this action? and i found there is a default data limit of 7500, which is troublesome for my simulation. Is there a way to toggle this limit off automaticly or easily when i create a new one?