Vectorized indexing cell array

1 view (last 30 days)
Craig
Craig on 24 Mar 2014
I have several (5000+) pressure-time histories in a cell array Data. Each cell in the Data array holds a two column vector of time and pressure. However, the times may be different, and the length of the vector may be different. I currently do this:
(read in all the data files in to the Data cell array)
Times = [];
for index = 1 : numel(file_list)
Times = [Times ; Data{index}(:,1)];
end
Times = unique(Times);
% Interpolate on to consistent time base
Press_all = zeros(length(Times), numel(file_list));
for index = 1 : numel(file_list)
Press_all(:,index) = interp1(Data{index}(:,1), Data{index}(:,2), Times);
end
Is there a better way, or a way to vectorize this? I would like to eliminate the for loops and do something like:
Times = unique(Data{1 : numel(file_list)}(:,1));
Except that the first : does not work.
And then maybe even:
Press_all = interp1(Data{1 : numel(file_list)}(:,1), Data{1 : numel(file_list)}(:,2), Times);
, although that may be pushing things a bit too far.
Thanks for any input

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!