I want to find different values in different matrices at the same date???
5 ビュー (過去 30 日間)
古いコメントを表示
Dear all, I have again a problem with the date. I have two different matrices with different dimensions. In the matrix jump is in the fist column the date, but the different points in time are not equally spaced. So some days between the years 2004 and 2012 are missing. In the second column are the values of the the jumps. The dimension of the matrix is 2746*2. The second matrix has the dimension 3288*4. So this matrix has also the date in the first column but much more points in time. I want to add the values of the first matrix to the second matrix and the values in the first matrix should be at the same day in the second matrix as before. So the date is the selection criterion. The date is converted to numbers. I tried it with an if else loop but I did not work. How can I add the values of jump to the second matrix??? Thank you in advance.
3 件のコメント
Azzi Abdelmalek
2013 年 2 月 20 日
編集済み: Azzi Abdelmalek
2013 年 2 月 20 日
What do you mean by to add a value? is it a sum or what? In the second matrix there are 3 columns while in the first there is one, where to add these values?
採用された回答
Thorsten
2013 年 2 月 20 日
A = [1 3; 2 4; 5 8];
B = [[1:5]' [ 40 50 60 70 80]'];
for i = 1:size(A, 1)
B(find(A(i,1)== B(:,1)), 3) = A(i, 2);
end
4 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Time Series Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!