Deleting an entire column using an IF statement
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jake Bowd
le 15 Juin 2020
Modifié(e) : madhan ravi
le 15 Juin 2020
Hi,
I have a 91 x 265 double for which sometimes the first column contains NaN values. If the first column contains NaN values I would like to delete it. If the first column does not inlcude NaN I wish to keep that as the first column.
data = RESULTS.IK_Original(1).data;
NaN 0.308000000000000 0.0290000000000000 -0.790000000000000 0.993000000000000
NaN 0.317000000000000 0.0280000000000000 -0.779000000000000 0.991000000000000
NaN 0.325000000000000 0.0270000000000000 -0.768000000000000 0.990000000000000
NaN 0.333000000000000 0.0260000000000000 -0.758000000000000 0.989000000000000
NaN 0.342000000000000 0.0250000000000000 -0.747000000000000 0.989000000000000
NaN 0.350000000000000 0.0240000000000000 -0.736000000000000 0.988000000000000
NaN 0.358000000000000 0.0230000000000000 -0.725000000000000 0.988000000000000
NaN 0.367000000000000 0.0220000000000000 -0.714000000000000 0.987000000000000
NaN 0.375000000000000 0.0200000000000000 -0.703000000000000 0.988000000000000
Note: this is just the first 9 rows and 5 columns of my data.
Many thanks,
0 commentaires
Réponse acceptée
madhan ravi
le 15 Juin 2020
Modifié(e) : madhan ravi
le 15 Juin 2020
data(:,all(isnan(data))) = [] % deletes entire column
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur NaNs 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!