Guy and Seth on Simulink

Model Explorer or Command Line? 2

Posted by Guy Rouleau,

Today I would like to ask you a question.

This week I received a large model where I wanted to find all the Lookup Table blocks and modify their Index Search Method parameter. Since the model was quite large and I was not familiar with it, manually navigating to each block, opening its dialog and modifying it was not an option.

So my question is: How would you accomplish this task?

Here are two options I considered.

Using functions at the MATLAB command prompt

For a long time, when I needed to find or modify blocks in a large Simulink model, I used the command prompt and functions like find_system, hilite_system and set_param.

For the example described above, I can find the blocks using find_system and see how they are connected in the model using hilite_system:

Finding blocks from command line

To change the Index Search Method, I can use set_param on the previous results:

Configuring blocks from command line

Using the Model Explorer

Recently, I started using the Model Explorer for this type of task and I think it is very efficient.

For the same task as above, I can easily search by block type. One thing I like is that I do not need to remember the exact string for the block type. The drop down looks at my model and offers me a list based on the blocks in my model.

Finding blocks using the Model Explorer

In the list of results, the Path column is a hyperlink I can click to immediately see where the block is in the model.

Finding blocks using the Model Explorer

To edit the Index Search Method for all the blocks found, I:

  • Add a column for this property
  • Select all the blocks using "shitf+Click"
  • Set the value for one instance, and it applies to all selected blocks

Finding blocks using the Model Explorer

Now it's your turn

What is your workflow to find and edit blocks in a large model? Let us know by leaving a comment here.

2 CommentsOldest to Newest

One can turn that for loop into a one-liner as well

cellfun(@(x) set_param(x, ‘IndexSearchMethod’, ‘Binary Search’), blks)

Command line all the way…

Add A Comment

What is 2 + 8?

Preview: hide

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