Simulink.findBlocks

Find blocks in Simulink models

Description

example

bl = Simulink.findBlocks(sys) returns handles to all blocks in the model or subsystem sys.

bl = Simulink.findBlocks(sys,options) finds blocks that match the criteria specified by a Simulink.FindOptions object.

bl = Simulink.findBlocks(sys,Param1,Value1,...,ParamN,ValueN) finds blocks whose block parameters have the specified values.

bl = Simulink.findBlocks(sys,Param1,Value1,...,ParamN,ValueN,options) finds blocks whose parameters have the specified values and that match the criteria specified by a FindOptions object.

Examples

collapse all

Return handles for all blocks in the model vdp.

load_system(vdp);
bl = Simulink.findBlocks('vdp')
bl =

    5.0001
   83.0001
   86.0001
    6.0001
    7.0001
    8.0001
    9.0001
   10.0001
   11.0001
   12.0001
   13.0001
   14.0001
   15.0001
   16.0001

Return block names.

bl = getfullname(Simulink.findBlocks('vdp'))
bl =

  12×1 cell array

    {'vdp/Fcn'                 }
    {'vdp/More Info'           }
    {'vdp/More Info/Model Info'}
    {'vdp/Mu'                  }
    {'vdp/Mux'                 }
    {'vdp/Product'             }
    {'vdp/Scope'               }
    {'vdp/Sum'                 }
    {'vdp/x1'                  }
    {'vdp/x2'                  }
    {'vdp/Out1'                }
    {'vdp/Out2'                }

Return block handles for the block whose name is Mu.

Simulink.findBlocks('vdp','Name','Mu')
ans =

    8.0001

Input Arguments

collapse all

Model or subsystem to find blocks in, specified as a character vector or string array.

Example: 'vdp' "f14/Aircraft Dynamics Model"

Search constraints, specified as a Simulink.FindOptions object.

Output Arguments

collapse all

Search results, returned as an array of handles.

Introduced in R2018a