www.gusucode.com > simbio 案例源码程序 matlab代码 > simbio/SpecifyAListOfSpeciesToBeLoggedDuringSimulationExample.m
%% Specify a List of Species to be Logged During Simulation % %% % Load the Lotka-Volterra Model. % Copyright 2015 The MathWorks, Inc. sbioloadproject lotka; %% % Get the configset object of the lotka model |m1|. configset = getconfigset(m1); %% % Display the list of species whose data are logged by default during % the simulation. configset.RuntimeOptions.StatesToLog %% % Suppose you want to log just species |y1| and |y2| data. You can specify % their names as a cell array of strings and set it to |StatesToLog| % property. configset.RuntimeOptions.StatesToLog = {'y1','y2'}; %% % Confirm the setting. configset.RuntimeOptions.StatesToLog %% % Alternatively, you can specify an array of species objects (instead of % strings) to |StatesToLog| property. y1 = m1.Species(2); y2 = m1.Species(3); configset.RuntimeOptions.StatesToLog = [y1, y2]; %% % Simulate and plot the results. Notice that simulation % results of only |y1| and |y2| are plotted. sbioplot(sbiosimulate(m1)); %% % To reset to the default list, set |StatesToLog| to a string |'all'|. configset.RuntimeOptions.StatesToLog = 'all'; %% % Simulate again. Notice all the species data are plotted. sbioplot(sbiosimulate(m1)); %% % Do not specify |'all'| as a cell string such as |{'all'}|. If so, % SimBiology interprets it as a species named |all|.