Extract specific values of first set of matrix on base of condition from second set of matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Shakir Hussain
el 28 de Mayo de 2018
Comentada: Shakir Hussain
el 28 de Mayo de 2018
There are two sets of matrix (A and B) with same size (8*8*5), A is precipitation data having random values from -10....to ....90 and B is the quality information of A with value 0, 2,10,5,1. we have to extract certain values of A which has quality (B) value only 0.
The matrix of extracted values should have same size of A and B (8*8*5)
We tried this
for i = 1:8;
for j = 1:8;
for k = 1:5;
if B == 0
A = B;
end
end
end
end
and it showed the logical output with 0 and 1 but we need the actually values of A which can any from -10....to ....90. else where the values of B is not 0 should be replace with 999
Thank you in advance for help
0 comentarios
Respuesta aceptada
Walter Roberson
el 28 de Mayo de 2018
You did not indicate what values you want in the places where B is not 0.
C = A;
C(B ~= 0) = nan;
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical 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!