Replace NAN in matrix with empty cells and reshape to matrix

조회 수: 8 (최근 30일)
Stef
Stef 2018년 6월 27일
댓글: Stef 2018년 6월 28일
I have a matrix X with several NAN values. I want replace the NAN with just blank cells, not zeros. Then I want to end up with a matrix. The problem is that it reshapes the matrix when I use this code
X(isnan(X))=[];
How can I replace the NAN with blanks and end up with the same matrix?
  댓글 수: 8
Guillaume
Guillaume 2018년 6월 28일
Then use functions that ignore nans by e.g. using the 'omitnan' of mean (or sum, or ...) in your analysis. Without more details of your analysis it's difficult for us to give you advice.
Stef
Stef 2018년 6월 28일
My analysis is a support vector machine and the matrix is the data which is split in train and testdata. Does omitnan keep the observation of other features or delete the whole row?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by