DOWNSAMPLEDATA - Downsamples DynaSim data structre data Usage: data_out = dsCalcFR(data,'option',value) Inputs: - data: DynaSim data structure (see dsCheckData) - ds: number of datapoints to downsample Outputs: - data_out: data structure all fields replaced by their decimated values See also: dsPlotFR, dsAnalyzeStudy, dsSimulate, dsCheckData, dsSelectVariables
0001 function data_out = dsDecimateData(data,ds) 0002 %DOWNSAMPLEDATA - Downsamples DynaSim data structre data 0003 % 0004 % Usage: 0005 % data_out = dsCalcFR(data,'option',value) 0006 % 0007 % Inputs: 0008 % - data: DynaSim data structure (see dsCheckData) 0009 % - ds: number of datapoints to downsample 0010 % 0011 % Outputs: 0012 % - data_out: data structure all fields replaced by their decimated values 0013 % 0014 % See also: dsPlotFR, dsAnalyzeStudy, dsSimulate, dsCheckData, dsSelectVariables 0015 0016 %% 1.0 Check inputs 0017 0018 data = dsCheckData(data, varargin{:}); 0019 % note: calling dsCheckData() at beginning enables analysis function to 0020 % accept data matrix [time x cells] in addition to DynaSim data structure. 0021 0022 %% do the decimating 0023 data_out = data; 0024 for i = 1:length(data) 0025 % Identify all fields in data containing simulated output 0026 labels = data(i).labels; 0027 0028 % Sweep through these fields and decimate 0029 for j = 1:length(labels) 0030 data_out(i).(labels{j}) = data(i).(labels{j})(1:ds:end,:); 0031 end 0032 0033 end 0034 0035 0036 end