Delete NaN in arrays in a cell

1 vue (au cours des 30 derniers jours)
Rudolf
Rudolf le 6 Mai 2021
Commenté : Rudolf le 6 Mai 2021
I have a 1x20 cell containing 20 arrays of double. Some of these arrays contains NaN. How can i delete them?
(If an array of double with 1 NaN is 101 long, it should be 100 after) Hope i explained it good enough.

Réponse acceptée

KSSV
KSSV le 6 Mai 2021
Let C be your cell array;
iwant = C ;
for i = 1:length(C)
idx = isnan(C{i}) ;
iwant{i} = C{i}(~idx) ;
end
  1 commentaire
Rudolf
Rudolf le 6 Mai 2021
Fantastic, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by