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

    %% Create Array of Operating Point Specification Objects
%%
% Open Simulink model.
sys = 'watertank';
open_system(sys)

%%
% Create a 2-by-3 array of operating point specification objects. You can
% batch trim model at multiple operating points using such arrays.
opspec = operspec(sys,[2,3]);

%%
% Each element of |opspec| contains a default operating point specification
% object for the model.

%%
% Modify the operating point specification objects using dot notation. For
% example, configure the second state of the specification object in row
% |1|, column |3|.
%
opspec(1,3).States(2).SteadyState = 1;
opspec(1,3).States(1).x = 2;

%%
% You can also create multidimensional arrays of operating point
% specification objects. For example, create a 3-by-4-by-5 array.
opspec = operspec(sys,[3,4,5]);