I have a mx1xn array (currently m=n=3), and I need to subtract from each column one value stored in a 1x1xn column.
i.e. n represents time, and from each instance of time, I need to subtract a different time-dependent constant from the data (1xm or whatever the dimensions are).
What is the best way to go at it? My attempt wont work:
data(:,2,:) - constants(:,2,:) %constants in this case is 1x1x3, data is 3x1x3
One attempt would be to loop it, but I'm wondering what is a more efficient way.
bsxfun(@minus, data, constants)