www.gusucode.com > slcontrol 案例源码程序 matlab代码 > slcontrol/AddBusElementsAsAnalysisPointsExample.m

    %% Add Bus Elements as Analysis Points
% Open the |scdbusselection| model.

% Copyright 2015 The MathWorks, Inc.

mdl = 'scdbusselection';
open_system(mdl);

%%
% Create an |slLinearizer| interface model.
sllin = slLinearizer(mdl);

%%
% The |COUNTERBUS| signal of |scdbusselection| contains multiple bus 
% elements. Add the |upper_saturation_limit| and |data|
% bus elements as analysis points to |sllin|. When adding elements within a 
% nested bus structure, use dot notation to access the elements of the 
% nested bus, for example |limits.upper_saturation_limit|.
blk = {'scdbusselection/COUNTERBUSCreator','scdbusselection/COUNTERBUSCreator'};
port_num = [1 1];
bus_elem_name = {'limits.upper_saturation_limit','data'};
addPoint(sllin,blk,port_num,bus_elem_name);

%%
% Both bus elements originate at the first (and only) port of the 
% |scdbusselection/COUNTERBUSCreator| block. Therefore, |blk| and |port_num| 
% repeat the same element twice.