Effacer les filtres
Effacer les filtres

Extract numbers from cell array

2 vues (au cours des 30 derniers jours)
Christian F.
Christian F. le 16 Avr 2012
Hi,
I have a cell array with both numbers and 'NA' strings for missing values.
Now I want to convert the cell array to a pure number array to use it for calculations, keeping all numbers and setting the 'NA' to NaN.
What would be the easiest way to achieve that?
Best regards,
Chris

Réponse acceptée

Walter Roberson
Walter Roberson le 16 Avr 2012
A(cellfun(@ischar,A)) = {NaN};
Amat = cell2mat(A);

Plus de réponses (0)

Catégories

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