Removing NaN in all the columns from matrix A to produce matrix B

1 vue (au cours des 30 derniers jours)
JL
JL le 28 Mai 2020
Commenté : JL le 28 Mai 2020
I have matrix A
A = [1 NaN 55 NaN 14 NaN 1 NaN 1 NaN 1
2 NaN 55 NaN 14 NaN 1 NaN 1 NaN 1
3 NaN 55 NaN 14 NaN 1 NaN 1 NaN 1
4 NaN 35 NaN 14 NaN 1 NaN 1 NaN 1];
Remove all the NaN
B = [1 55 14 1 1 1
2 55 14 1 1 1
3 55 14 1 1 1
4 35 14 1 1 1];

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 28 Mai 2020
Modifié(e) : Fangjun Jiang le 28 Mai 2020
index=any(isnan(A));
B=A(:,~index)

Plus de réponses (0)

Catégories

En savoir plus sur NaNs 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