필터 지우기
필터 지우기

Extract numbers from cell array

조회 수: 2 (최근 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 CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by