nanarray = isnan(A); B(nanarray==1) = NaN;
Did you mean to have the B(3,2)=NaN instead of B(3,1)?
Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Hi!
If I have two matrices:
A=[1 2 NaN; 4 NaN 6; NaN 8 9] B=[11 12 13; 14 15 16; 17 18 19]
And I want to turn the elements in B corresponding to the elements that are NaN in A also into NaN, how would I do it? Basically the end result I want is:
A=[1 2 NaN; 4 NaN 6; NaN 8 9] B=[11 12 NaN; 14 NaN 16; 17 NaN 19]
But my matrices are a lot bigger and I need a systematic approach.
Thanks in advance!
nanarray = isnan(A); B(nanarray==1) = NaN;
Did you mean to have the B(3,2)=NaN instead of B(3,1)?
La pregunta está cerrada.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!