Simulink.FindOptions class

Package: Simulink
Superclasses:

Options for finding blocks in models and subsystems

Description

Create an options object to use with Simulink.findBlocks and Simulink.findBlocksOfType to constrain the search.

Construction

f = Simulink.FindOptions creates a FindOptions object that uses the default search options.

f = Simulink.FindOptions(Option1,Value1,...OptionN,ValueN) creates the object using the specified search options.

Input Arguments

expand all

Option to specify whether to match case when searching, specified as true for case-sensitive search or false for case-insensitive search.

Option to follow library links, specified as true or false. If true, search follows links into library blocks.

Option for the search to include commented blocks, specified as true or false.

Options to search masked blocks, specified as:

  • 'all' — Search in all masked blocks.

  • 'none' — Prevent searching in masked systems.

  • 'functional' — Include masked subsystems that do not have dialogs.

  • 'graphical' — Include masked subsystems that do not have workspaces or dialogs.

Options to search Variant subsystems, specified as:

  • 'AllVariants' — Search all variant choices.

  • 'ActiveVariants' — Search only active variant choices.

  • 'ActivePlusCodeVariants' — Search all variant choices with 'Generate preprocessor conditionals' active. Otherwise, search only the active variant choices.

The 'Variants' search constraint applies only to variant subsystems and model variants.

Option to treat the search text as a regular expression, specified as true or false. To learn more about MATLAB® regular expressions, see Regular Expressions (MATLAB).

Levels in the model to search, specified as a positive integer. The default is to search all levels. Specify:

  • 1 — Search in the top-level system.

  • 2 — Search the top-level system and its children, 3 to search an additional level, and so on.

Examples

collapse all

Search for all blocks in the Unlocked subsystem but not in any of its children.

f = Simulink.FindOptions('SearchDepth',1);
load_system('sldemo_clutch');
bl = Simulink.findBlocks('sldemo_clutch/Unlocked',f)
bl =

   1.0e+03 *

    1.1140
    1.1150
    1.1160
    1.1170
    1.1180
    1.1190
    1.1200
    1.1210
    1.1220
    1.1230
    1.1240
    1.1250
    1.1260
    1.1270
    1.1280
    1.1290
    1.1300
    1.1310
    1.1320
    1.1330

To get the block name and path instead of the handle, use getfullname.

bl = getfullname (Simulink.findBlocks('sldemo_clutch/Unlocked',f))
bl =

  20×1 cell array

    {'sldemo_clutch/Unlocked/Tfmaxk'                     }
    {'sldemo_clutch/Unlocked/Tin'                        }
    {'sldemo_clutch/Unlocked/Enable'                     }
    {'sldemo_clutch/Unlocked/E_Sum'                      }
    {'sldemo_clutch/Unlocked/Engine↵Damping'             }
    {'sldemo_clutch/Unlocked/Engine↵Inertia'             }
    {'sldemo_clutch/Unlocked/Engine↵Integrator'          }
    {'sldemo_clutch/Unlocked/Goto'                       }
    {'sldemo_clutch/Unlocked/Goto1'                      }
    {'sldemo_clutch/Unlocked/Max↵Dynamic↵Friction↵Torque'}
    {'sldemo_clutch/Unlocked/V_Sum'                      }
    {'sldemo_clutch/Unlocked/Vehicle↵Damping'            }
    {'sldemo_clutch/Unlocked/Vehicle↵Inertia'            }
    {'sldemo_clutch/Unlocked/Vehicle↵Integrator'         }
    {'sldemo_clutch/Unlocked/W_Slip'                     }
    {'sldemo_clutch/Unlocked/slip direction'             }
    {'sldemo_clutch/Unlocked/w0'                         }
    {'sldemo_clutch/Unlocked/w0 '                        }
    {'sldemo_clutch/Unlocked/we'                         }
    {'sldemo_clutch/Unlocked/wv'                         }

Introduced in R2018a