# I can’t believe it took me 6 months to find that!13

Posted by Guy Rouleau,

This week, after using Simulink R2012b for 6 months, I discovered a little something I find very useful.

Closing Tabs

I dig through models all day and I always end up with lots of open tabs. Up to now, closing tabs for me meant clicking the x on each tab one by one:

Closing Other Tabs

One day I told myself: I am probably not the only person with many tabs to close, there must be an easier way!

I searched a little bit and found that the File menu has a Close Other Tabs option:

Are there other features like this one that you wish you had discovered long ago? Let us know by leaving a comment here.

Les replied on : 1 of 13

I’m not sure I’m very impressed by this. Most other tabbed GUIs that I’ve seen provide a right click menu on the tab itself that includes this option (and other relevant options). A keyboard shortcut would be even better.

Many of the new features in the Simulink model editor are bringing it out of the dark ages of graphical editors, so kudos for that and I hope to see further progress.

Les replied on : 2 of 13

I do have to add that it is nice that the Simulink model editor still has a menu and a traditional small icon toolbar. Wish this was still available in the main Matlab window so I could find things where they have been for years and years.

Alex replied on : 3 of 13

Hi,

is it possible to open referenced models in a tab instead of a new window? I didn’t find how to do this…

Thanks Guy for this! After seeing this post, it got me wondering if the MATLAB Editor had something similar. And it did! If you right-click on an open MATLAB file (the tab), one of the context menu items is “Close all except thisfile.m”. Nice!

jiro

@Les: I agree with you that a right-click menu on the tab would make this sort of option easier to find. I forwarded all your comments to our development team.

@Alex: This is not possible in R2012b. We are looking into providing the capability to open referenced models in a new tab instead of separate window.

@Jiro: I did exactly the same thing! After noticing Simulink has a “Close Other Tabs” option, I went to the MATLAB Editor, looked for something similar and found what you describe. Thanks for sharing.

Chris replied on : 6 of 13

Sometimes it’s the simple things. I just learned today that there’s a shortcut for hiding a block’s name. Right-click the text and then hit delete.

Suggestion: A good list of these shortcuts would be helpful. I know you show a few.

Aditya Shah replied on : 7 of 13

That is cool.
Some additional things related to this that would be great are:
– Ctrl+W closes the tab and not the file.
– Shift+Ctrl+T reopens the last closed tab
– Ctrl+T opens a new tab. It could open the root level of the model.

These 3 shortcuts are in most web browsers today.

I think any shortcuts so that you can do most functions with only the keyboard would be great. That way you don’t have to move your hand to the mouse and then back to the keyboard.

Tiling tabs in the same window would be very useful because that allows for easy drag and drop copying.

Is there a way to easily copy from one tab to another using the mouse (like RMB+drag to copy)?

@Aditya: Those are great suggestions, I will definitely pass to our development team.

Phil Taylor replied on : 9 of 13

One I’ve just discovered…

I can’t drag or right-click a tab and open it in a separate window (think of a two monitor desktop). I have to go back to the parent, right-click on the block, and from there I can choose to open in a new window. I know it can be done from the Model Browser but I find that left pane to obtrusive it wastes too much space. Mentally maintaining the hierarchical link between the tree-view and the diagram just doesn’t work for me, and the same applies with the ‘breadcrumbs’ Explorer-style address bar above the diagram.

Basically, think how Chrome’s tabs behave…

Arun replied on : 10 of 13

Is there a command to close all the tabs?

Michael K. replied on : 11 of 13

Thanks for this tip.

At the moment I’m looking for a way to do this programmatically i.e. close all tabs but the one with the root model. At least there must be a way to get all handles to all open tabs, exclude the root model and close them.
Do you know of any way to do this?

@Michael K: To find all the open subsystem, you can use find_system:

blks = find_system(bdroot,'LookUnderMasks','all',...
'Variants','AllVariants',...
'blocktype','SubSystem',...
'open','on')


Then close them all using close_system:

cellfun(@close_system,blks)

Michael K. replied on : 13 of 13

Thank you very much, Guy. That was exactly what I’m looking for!

After Variants I added the line

'IncludeCommented', 'on', ...

because I have a few commented subsystems which are sometimes opened as tabs.

I need to close all tabs, or else my compiler throws an error if the root model isn’t the only tab. Thereafter I reopen the tabs which where saved in blks.

Best regards, Michael

What is 5 + 10?

Preview: hide

These postings are the author's and don't necessarily represent the opinions of MathWorks.