find_blocksets.m

来自「Matlab实现SONET/SDH光通信系统simulink仿真程序源代码」· M 代码 · 共 32 行

M
32
字号
function [blocksets]=find_blocksets()

% Open the model of interest before running this file.
%
% This function will output what blocksets are used in the model you
% currently have selected.  
%
% J. Kluza 10/30/03

clear

blocks=find_system(gcs, 'followlinks', 'on'); 

for i=1:length(blocks)
    if not(isequal('block_diagram',char(get_param(blocks(i), 'type'))))
        sources(i)=get_param(blocks(i), 'referenceblock');
        if isempty(sources(i))
            sources(i)=get_param(blocks{i}, 'ancestorblock');
        end
        if not(isequal(sources{i}, ''))
            allblocksets(i)=cellstr(strtok(sources{i}, '/')) ;
        end        
    end
end

if (isequal(sources{:}, ''))
    disp('No blocksets were found.')
else
    %disp('The blocksets used in this model are: ')
    blocksets=unique(cellstr(strvcat(allblocksets{:})));
end

⌨️ 快捷键说明

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