Replace NAN in matrix with empty cells and reshape to matrix

1 vue (au cours des 30 derniers jours)
Stef
Stef le 27 Juin 2018
Commenté : Stef le 28 Juin 2018
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 commentaires
Guillaume
Guillaume le 28 Juin 2018
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 le 28 Juin 2018
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?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by