Main Content

万博1manbetxsimulink.findoptions

指定在模型和子系统中查找块的选项

Description

万博1manbetxsimulink.findoptions对象允许您使用万博1manbetxsimulink.findblocksand万博1manbetxsimulink.findblocksoftypeFunctions.

创建

Description

F= Simulink.FindOptions创建一个查找使用默认搜索选项的对象。

例子

F= 万博1manbetxsimulink.findoptions(名称,价值properties使用名称值对。例如,万博1manbetxsimulink.findoptions('SearchDepth',1)创建一个查找具有搜索深度的对象1。您可以指定多个名称值对。将每个属性名称包装在单引号中。

特性

展开全部

搜索时匹配案例的选项,指定为true用于病例敏感的搜索或错误的For case-insensitive search.

数据类型:逻辑

搜索的选项以遵循库链接,指定为trueor错误的。如果true,搜索以链接为库块。

数据类型:逻辑

搜索选项以包括注释的块,指定为trueor错误的

数据类型:逻辑

搜索蒙版块的选项,指定为:

  • '全部'-Search in all masked blocks.

  • '没有任何'-Prevent searching in masked systems.

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

  • 'graphical'- 包括没有工作区或对话框的蒙版子系统。

数据类型:char|细绳

笔记

Variants论点将被删除。利用MatchFilter反而。有关更多信息,请参阅Compatibility Considerations

搜索变体子系统的选项,,,,specified as:

  • “ allvariants”- 搜索所有变体选择。

  • “ActiveVariants”- 仅搜索主动变体选择。

  • “ ActivePlusCodeVariants”-Search all variant choices in theVariant Subsystemthat are active in simulation and is part of the generated code.

This search constraint applies only toVariant Subsystemblocks that have theVariant control mode调成表达or标签。使用万博1manbetxsimulink.findoptionsobject with theMatchFilteroption to operate on all types of variant blocks.

数据类型:char|细绳

匹配元素的功能句柄in a search, such as blocks, system, lines, ports, and annotations. UseMatchFilterto determine whether elements should be included or skipped in a search.

这named function must be defined within a MATLAB®程序文件。该函数将元素的句柄作为输入,并返回两个输出。

Function[匹配,修剪] = func(元素)
  • 输入元素是正在处理的块的手柄。

  • 第一个输出,match,是逻辑值。如果错误的,搜索跳过元素。

  • 这second output,prune,,,,is an optional logical value that only applies when元素是一个子系统。默认值是错误的。如果将此值设置为true,从搜索中省略了整个子系统。

Example: UseMatchFilterto find allGain模型中的块vdpwith a gain value between1and10

Functionmatch = gainOnetoten(blk)match = false;如果strcmp(get_param(blk,'类型'),'堵塞'...&& strcmp(get_param(blk,'blocktype'),'获得')gainValue = str2double(get_param(blk,'获得');match = gainValue> = 1 && gainValue <= 10;结尾结尾
load_system('vdp');FindOptObj = Simulink.FindOptions('MatchFilter',@gainonetoten);blks = getfullname万博1manbetx((simulink.findblocks)('vdp',findoptobj)));

Variants:万博1manbetxSimulink提供Simulink.match.activeVariantsand万博1manbetxsimulink.match.codecompilevariants匹配滤波器功能的变体块,您可以使用它们来查找活动变体或代码编译变体块。为此,请编译模型并应用适当的MatchFilter选项:

  • Simulink.match.activeVariants- 匹配模型汇编后在模拟中活跃的块

  • 万博1manbetxsimulink.match.codecompilevariants- Matches blocks that are part of generated code after model compilation

Example: Use theSimulink.match.activeVariantsoption to find active variants in a model:

addpath(fullfile(matlabroot,'examples',,,,'simulink_variants',,,,'main');模型='sldemo_variant_subsystems';load_system(model); assignin('base',,,,'vss_mode',,,,2);set_param(model,“仿真”,,,,'更新');findoptobj =万博1manbetx simulink.findoptions('MatchFilter', @万博1manbetxsimulink.match.activevariants);blks = getfullname万博1manbetx(((simulink.findblocks)(型号,findoptobj)))))

Example: Use the万博1manbetxsimulink.match.codecompilevariantsoption to find variant choices that are part of the generated C code:

addpath(fullfile(matlabroot,'examples',,,,'simulink_variants',,,,'main');load_system('sldemo_variant_subsystems');分配('base',,,,'vss_mode',,,,2);sldemo_variant_subsystems([],[],[],,'compileforcodegen');FindOptObj = Simulink.FindOptions('MatchFilter',,,,@Simulink.match.codeCompileVariants); blks=getfullname((Simulink.findBlocks('sldemo_variant_subsystems',findoptobj)));sldemo_variant_subsystems([],[],[],,'学期');

Option to treat search text as a regular expression, specified astrueor错误的。要了解有关MATLAB正则表达式的更多信息,请参阅常用表达

数据类型:逻辑

搜索模型的级别,指定为正整数。默认(-1)是搜索所有级别。指定:

  • 1-Search in the top-level system.

  • 2- 搜索顶级系统及其孩子,3to search an additional level, and so on.

数据类型:int32

Examples

collapse all

创建一个万博1manbetxsimulink.findoptions指定搜索深度的对象1

f = 万博1manbetxsimulink.findoptions('SearchDepth',,,,1);

使用查找object, search for all blocks in the subsystem named解锁,但不在任何一个孩子中。

openExample('sldemo_clutch');bh = 万博1manbetxsimulink.findblocks('sldemo_clutch/Unlocked',F);

万博1manbetxsimulink.findblocks功能返回块手柄。

要获取块路径,请使用getfullname功能。

bp = getfullname(BH)
bp = 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' }

Compatibility Considerations

展开全部

Warns starting in R2021a

在R2018A中引入