www.gusucode.com > simulink 案例源码程序 matlab代码 > simulink/MATLABStructwithSpecifiedDimExample.m
%% MATLAB Structure with Specified Dimensions % Open a Simulink(R) model and simulate it. model = fullfile(matlabroot,'examples','simulink','busic_example'); open_system(model); sim('busic_example') %% % Create a partial structure, which is a MATLAB(R) structure that specifies % values for a subset of bus elements for the bus signal created by the % TopBus block. PartialStructForK = struct('A',struct('A1',4),'B',3) %% % Create a MATLAB structure using the bus object |Top| (which the |busic_example| % model loads), a partial structure, and dimensions for the resulting structure. structFromBus = Simulink.Bus.createMATLABStruct... ('Top',PartialStructForK,[2 3]) %% % Close the system. close_system('busic_example')