Vectorized indexing cell array

2 ビュー (過去 30 日間)
Craig
Craig 2014 年 3 月 24 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by