www.gusucode.com > simulink 案例源码程序 matlab代码 > simulink/StoreDatainSimulationMetadataObjectofvdpSimulationExample.m
%% Store Data in SimulationMetadata Object of vdp Simulation % Simulate the |vdp| model. Store custom data in the |SimulationMetadata| % object that the |SimulationOutput| object contains. %% % Simulate the |vdp| model. Save the results of the |Simulink.SimulationOutput| % object in |simout|. open_system('vdp') simout=sim(bdroot,'ReturnWorkspaceOutputs','on'); %% % Store custom data about the simulation in the |SimulationMetadata| object % that |simout| contains. simout=simout.setUserData(struct('param1','value1','param2','value2','param3','value3')); %% % Use |SimulationOutput.getSimulationMetadata| to retrieve the information % you stored. mData=simout.getSimulationMetadata(); disp(mData.UserData)