How can I matching data from different matrices
3 ビュー (過去 30 日間)
古いコメントを表示
Hi!
I have 2 matrices [A], [B], with different dimensions ([A]=4450x10 & [B]=3656x5). The first column in both matrices is the day with numbers 1:365. But some days are missing, not the same days from the two matrices. Also,for each day I have different number of data. For example, in the day 15 in [A] I have 12 lines and in the [B] I have 4 lines. I found the common days:
Common_days = intersect(A(:,1),B(:,1));
Then, I want to create two files (one for each matrix), which will include only the data with the common days.
Extra, I want to plot in the same graph, the data with the same day from [A] & [B]. The columns I want to plot are [A]=2 & 10, [B]=2&5
0 件のコメント
採用された回答
その他の回答 (1 件)
Image Analyst
2015 年 3 月 20 日
Use ismember() to find out what rows Common_days are in. Then just use indexing
[ia, ib] = ismember(.......
subsetA = A(rowsToExtract, :);
I can't remember if rowsToExtract is ia or ib but you'll know which it is after you run it.
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!