필터 지우기
필터 지우기

Deleting the same column in different matrices

조회 수: 2 (최근 30일)
Sascha  Winter
Sascha Winter 2017년 3월 15일
댓글: Sascha Winter 2017년 3월 15일
Hello everyone,
i' ve got the following problem. I have a matrix A with 256x7690 where a lot of columns containing just NaN's. For that reason I want to delete these columns as a first step. In a second step it should further delete the same column number in some other matrices (which have the same number of columns). So for example the 4th and the 29th column contain all NaN's it should delete these two columns and delete the same columns in Matrices B,C,D and E. Note, that I have about 3500 columns which contains all NaN's.
Thanks in Advance.

채택된 답변

KSSV
KSSV 2017년 3월 15일
You can remove 4th column from a matrix A using
A(:,4) = [] ;
Similarly for other matrices...To get the position of NaN's use isnan.
  댓글 수: 2
Jan
Jan 2017년 3월 15일
And explicitly:
Index = all(isnan(A, 1)); % Find columns which are all NaN
A(:, Index) = [];
B(:, Index) = [];
C(:, Index) = [];
...
Sascha  Winter
Sascha Winter 2017년 3월 15일
Thanks, for that i was searching for.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by