%% Subtract Mean from Data
% Create a timeseries object with 2-D data, and subtract the mean of each column from the data.

A = magic(3)
tsin = timeseries(A,[1 2 3]);
tsout = detrend(tsin,'constant');
tsout.Data

% Subtract the mean of each column for only the second and third columns of data.

tscol = detrend(tsin,'constant',[2 3]);
tscol.Data

% Copyright 2012 The MathWorks, Inc.