# Guy and Seth on Simulink

## Model Explorer or Command Line?

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:

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

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.

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

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

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

### 2 Responses to “Model Explorer or Command Line?”

1. Paul replied on :

Model Explorer all the way…

2. Mohsen Nosratinia replied on :

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…

 Name (required) E-mail (required, will not be published) Website (optional) Spam protection (required): What is 3 + 4 ?

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).

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 MathWorks.