%% Remove Subset of Simulation Data from SimData
% Load the model of glucose-insulin response. For details about the model, see the Background section in Simulating the Glucose-Insulin Response.

sbioloadproject('insulindemo.sbproj','m1');

%
% Suppress an information warning that is issued during simulations.

warnSettings = warning('off', 'SimBiology:DimAnalysisNotDone_MatlabFcn_Dimensionless');

%
% Simulate a single meal for a normal subject for 7 hours.

singleMeal = sbioselect(m1,'Name','Single Meal');
cs = getconfigset(m1,'active');
cs.StopTime = 7;
sd1 = sbiosimulate(m1,singleMeal)
sbioplot(sd1);

%
% Remove all parameter data logged in the SimData object sd.

[t,x,names] = remove(sd1,{'Type','parameter'});

%
% Remove all parameter data and return as a new SimData object.

sd2 = remove(sd1,{'Type','parameter'});
sbioplot(sd2);

%
% Remove the simulation data of a species by specifying its name.

sd3 = removebyname(sd2,["[Insulin secretion].[Ins Delay 2]"]);
sbioplot(sd3);

%
% Restore the warning settings.

warning(warnSettings);

% Copyright 2020 The MathWorks, Inc.