How can I matching data from different matrices
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Thar
el 20 de Mzo. de 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 comentarios
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 20 de Mzo. de 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.
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!