Borrar filtros
Borrar filtros

how to create matrix based on column conditions

2 visualizaciones (últimos 30 días)
Poulomi Ganguli
Poulomi Ganguli el 22 de Ag. de 2018
Comentada: Poulomi Ganguli el 22 de Ag. de 2018
Hello I have two different matrices A and B as below:
A=
9 16 1966 65.3
9 16 1967 73
9 16 1968 78.9
12 23 1966 61
12 23 1967 63.2
12 23 1968 51.8
12 28 1966 0
12 28 1967 0
12 28 1968 0
12 29 1966 0
12 29 1967 0
12 29 1968 0
B =
1 16 919.3254136
1 23 3979.074644
1 28 3582.388628
1 29 8401.61424
I need to create a third matrix C, which will take the value from Matrix A and fill the corresponding value at Matrix B in the form of time series/ the combination of both matrices
C =
1 16 919.3254136 1966 65.3
1 23 3979.074644 1966 61
1 28 3582.388628 1966 0
1 29 8401.61424 1966 0
1 16 919.3254136 1967 73
1 23 3979.074644 1967 63.2
1 28 3582.388628 1967 0
1 29 8401.61424 1967 0
1 16 919.3254136 1968 78.9
1 23 3979.074644 1968 51.8
1 28 3582.388628 1968 0
1 29 3582.388628 1968 0
I am trying with ismember but could not able to make it. Any help?

Respuesta aceptada

Matt J
Matt J el 22 de Ag. de 2018
Editada: Matt J el 22 de Ag. de 2018
C=innerjoin(array2table(B),array2table(A),'LeftKeys','B2','RightKeys','A2')
and then use table2array(), if needed.

Más respuestas (0)

Categorías

Más información sobre Cell Arrays 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!

Translated by