Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
Szabó-Takács Beáta
Szabó-Takács Beáta 2015 年 9 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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!

回答 (2 件)

Matt J
Matt J 2015 年 9 月 16 日
map=isnan(A);
J=any(map,1);
I=any(map,2);
longitude(I,J)=[];
latitude(I,J)=[];

Thorsten
Thorsten 2015 年 9 月 16 日
ind = isnan(A);
longitude(:, any(ind)) = []; % delete columns
longitude(any(ind'), :) = []; % delete rows

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by