Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How can delete same rows and colums from three 2D matrices?

1 visualización (últimos 30 días)
Szabó-Takács Beáta
Szabó-Takács Beáta el 16 de Sept. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hi All, I have three 2D matrices: longitude (191x177), latitude(191x177) and A(191x177). Matrix "A" contains some NaN values. I would like to delete the rows and colums which contain NaN in A from both matrices. Could someone suggest me a solution? Thank you for your help in advance!

Respuestas (2)

Matt J
Matt J el 16 de Sept. de 2015
map=isnan(A);
J=any(map,1);
I=any(map,2);
longitude(I,J)=[];
latitude(I,J)=[];

Thorsten
Thorsten el 16 de Sept. de 2015
ind = isnan(A);
longitude(:, any(ind)) = []; % delete columns
longitude(any(ind'), :) = []; % delete rows

La pregunta está cerrada.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by