Filter löschen
Filter löschen

Extract numbers from cell array

2 Ansichten (letzte 30 Tage)
Christian F.
Christian F. am 16 Apr. 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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Apr. 2012
A(cellfun(@ischar,A)) = {NaN};
Amat = cell2mat(A);

Weitere Antworten (0)

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by