Extract numbers from cell array

1 回表示 (過去 30 日間)
Christian F.
Christian F. 2012 年 4 月 16 日
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

採用された回答

Walter Roberson
Walter Roberson 2012 年 4 月 16 日
A(cellfun(@ischar,A)) = {NaN};
Amat = cell2mat(A);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by