How can I matching data from different matrices
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Thar
am 20 Mär. 2015
Bearbeitet: Stephen23
am 21 Mär. 2015
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 Kommentare
Weitere Antworten (1)
Image Analyst
am 20 Mär. 2015
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.
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!