Guy and Seth on Simulink

April 29th, 2009

Pick of the week: Customizing Simulink

This week I am borrowing the Pick of the Week blog format pioneered by Scott and Doug and carried on by the three amigos: Bob, Brett and Jiro.

Simulink Pick of the Week

Seth’s pick this week is Customizing the Simulink Interface Demo by Saurabh Mahapatra

While browsing through the file exchange, I clicked on the Simulink tag to see the latest Simulink files.  Saurabh’s demo of how to customize the Simulink interface was right at the top.  You can really appreciate what is in this submission without even downloading it.  The ZIP file contains a published M-file that documents and explains each customization in detail. (Everyone should do this!)

Customizing the Simulink Interface Demo on the MATLAB Central File Exhcange

Saurabh explains how to make a few key customizations to the Simulink interface.

Reordering Libraries in Simulink Library Browser.

Reordered libraries in the Simulink library browser

If you don’t like the default order of libraries (alphabetical, with Simulink always on top), you can reorder them.  This is particularly helpful if you use a pallet library to keep you custom blocks on hand.  (I have previously blogged about adding custom libraries.)

Disabling and Hiding Libraries in Simulink Library Browser.

Hidden libraries and disabled libraries in Simulink

Why would you ever want to do this?  Well, I most often hear the request from larger teams that need to restrict the blocks allowed in their design.  If your team doesn’t allow continuous blocks in their controller model, it might be easier to keep them out of sight and prevent their insertion from the start.

Customizing Simulink Menus.

Custom menus added to Simulink

The example here is very simple, but I have used this one myself.  I made a custom menu that would generate a bus object for the currently selected port or bus creator.  This saved me the time of having to type Simulink.Bus.createObject('model', 'model/Bus Creator').

Disabling and Hiding Options in Configuration Parameters Dialog.

Disabling and hiding stuff in the configuration prarameters

Just about every menu and configuration parameter can be enabled/disabled and hidden.  This flexibility helps when enforcing team modeling styles and preventing common errors because of mistaken settings.

Now it’s your turn

I hope you will download the file, rate it, and leave comments.  How do you use customizations?  Leave me a comment here, or submit your own customizations to the file exchange!

2 Responses to “Pick of the week: Customizing Simulink”

  1. Arda replied on :

    Hi,
    Firstly, many thanks for the guide. But I get an error when I want to reorder the libraries. Everything else works fine but I guess there is a mistake about LibraryBrowserCustomizer command. Matlab doesn’t seem to recognize that.

    Forexample;

    I’ve created a file named sl_customization.m under MATLAB path which includes this function;

    function sl_customization(cm)
    cm.LibraryBrowserCustomizer.applyOrder( {‘Simulink Extras’, -2} );
    end

    When I try to refresh the customizations (with sl_refresh_customizations command), I get;

    >> sl_refresh_customizations;
    Warning: No appropriate method or public field LibraryBrowserCustomizer for class DAStudio.CustomizationManager.
    > In sl_refresh_customizations>call_all at 91
    In sl_refresh_customizations at 52
    >>

    And nothing changes in the original library order. Am I doing something wrong here?

    By the way I am using 2007a release. But again, everything works fine except that LibraryBrowserCustomizer command.

    Thanks in advance.

  2. Arda replied on :

    It seems like costumization in terms of reordering the libraries in simulink is a new feature of the 2009a release.
    I have seen that in a previos post and after a quick search in relese notes of 2009a it appears to be a new feature.

    http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/rn/brwgg9h.html#brwgqkv-1

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks
Guy Rouleau and Seth Popinchalk are Application Engineers for MathWorks. They write here about Simulink and other MathWorks tools used in Model-Based Design.

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