フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Matching rows in different matrices

1 回表示 (過去 30 日間)
Muneer
Muneer 2013 年 12 月 9 日
閉鎖済み: Azzi Abdelmalek 2013 年 12 月 9 日
I have a time array = [0 0.06 .12 .18 .24 ... 7684.3] which has a total of 128072 (128072x1) elements.
I have a separate matrix called timedata with time in the first column (has some repeated elements) and a data value in the second column. It looks like this: 0 0 0 0 .06 0 .12 0 .18 0 .24 0 ... ... 7684.3 0
Its dimensions are 128425x2 because it has some repeated elements (as you can see 0 is repeated twice because I combined two matrices together and then sorted them in ascending order). I want to use my time vector as a control and pick the values from timedata that match. So the first val in "time" is 0, take the whole row of "timedata" where the first column is 0. The second val in "time" is .06 so I want to take the row that matches in "timedata". This would give me the third row and skip the second. At the end of this process, I would have a matrix with the same number of rows as "time". Any ideas on how to do this? I tried using a for loop like this
for i = 1:length(time)
new(i) = timedata(time(i), i);
end
But I don't think I'm indexing correctly. Any help would be greatly appreciated. Thanks in advance.
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 9 日

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by