MATLAB: Resampling a matrix of data to increase data sample rate

interpnMATLABmatrixresampling

Hi,
I have two matrices (M1 and M2) of acquired data from disparate devices, each sampling at different sample rates. Data in M1 was acquried at 200Hz. Data in M2 was acquried at 400Hz. Both matrices have a timestamp column at column 1. M1 then has 4 columns representing acquired channel data at each timestamp. M2 has 6 columns, also representing acquried channel data.
I'm trying to resample the four data channels in M1 to increase their sample rate to 400Hz, to be in line with the data in M2.
I've tried using interpn() with some success when feeding in a single data channel from M1:
dev1Time = M1(:,1);
dev2Time = M2(:,1);
dev1Chan = M1(:,2);
vNew = interpn(dev1Time, dev1Chan, dev2Time);
Is there a way of performing this task on all data channels in M1 at the same time? Or do I just have to use a FOR loop to access each data channel separately?
Or would anyone be able to recommend a more appropriate method please?

Best Answer

Use the Signal Processing Toolbox resample (link) function. It is specifically designed for signal resampling, and includes an anti-aliasing filter. It will resample matrices as well.
Related Question