Code covered by the BSD License  

Highlights from
find_in_models: Search the entire block diagram hierarchy

1.5

1.5 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 3.03 KB File ID: #15707

find_in_models: Search the entire block diagram hierarchy

by Malcolm Wood

 

26 Jul 2007 (Updated 26 Jan 2010)

A wrapper for find_system which searches inside model references

| Watch this File

File Information
Description

find_system provides the option to search inside library links, but does not currently give the option to search inside model references.

This function provides this option, and, unlike find_system itself, can also close block diagrams after searching them. This ensures scalability when searching large hierarchies. The usage is very similar to that of find_system itself except that a model name or handle must be specified. The return type also depends on the inputs in the same way as for find_system: specifically the return type is a cell array of strings unless the input is a numeric handle ot the "FindAll" option is supplied and "on".

When the return type is a cell array of strings, any block diagrams which are loaded during the search are closed again. This means that the caller must take care before calling get_param on any returned string. It also means that the model does not need to be loaded before calling this function.

This function can be used for tasks such as:
* Finding all the Lookup Table blocks involved in a simulation
* Finding any models involved a simulation which have some parameter value
* Finding all lines in a simulation which link to a particular requirement
etc.

See the Help in the M-file for examples.

Acknowledgements
This submission has inspired the following:
Manchester
Required Products Simulink
MATLAB release MATLAB 7.4 (R2007a)
Other requirements Tested on Windows with R2007a, but should work on all platforms and in all releases since R12.1.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
03 Mar 2008 Thierry Dalon

It calls function find_mdlref_blocks which I could not find.

05 Mar 2008 Malcolm Wood

I've fixed that now (find_mdlrefs_blocks is only available in R2007a and later) so this function should now work in earlier releases too.

18 Mar 2008 Simon B.

Sorry, but this scipt does not search inside model references.

26 Jan 2010 Malcolm Wood

You may have run into the bug I just fixed, where model references inside library links weren't followed.

Please login to add a comment or rating.
Updates
04 Mar 2008

The previous revision relied on a function which was introduced in R2007a. To make this file work in earlier versions of Simulink I have added a workaround.

17 Dec 2009

Review

26 Jan 2010

Fixed a bug in which model references inside library links were not followed. Now, if you specify FollowLinks=on then the function will search models which are referenced from inside library links.

Tag Activity for this File
Tag Applied By Date/Time
simulink Malcolm Wood 22 Oct 2008 09:20:44
find_system search find models Malcolm Wood 22 Oct 2008 09:20:44

Contact us at files@mathworks.com