find_masked_blocks.m

来自「CheckMate is a MATLAB-based tool for mod」· M 代码 · 共 27 行

M
27
字号
function blockH = find_masked_blocks(sys,masktype)

% Find masked blocks in a flat Simulink system
%
% Syntax:
%   "blockH = find_masked_blocks(sys,masktype)"
%
% Description:
%   "find_masked_blocks(sys,masktype)" returns an array of handles to all
%   blocks in "sys" of type "masktype".
%
% Note:
%   "find_masked_blocks()" assumes a flat Simulink system which means
%   that it will not search below the root level in the system
%   hierarchy. 

% Find all masked blocks in the current system, assuming flat simulink
% model.
blocks = find_system(sys,'SearchDepth',1,'MaskType',masktype);

% Get the simulink handle for each block and put it in a vector
blockH = zeros(1,length(blocks));
for k = 1:length(blocks)
  blockH(k) = get_param(blocks{k},'Handle');
end
return

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?