This is my data:
a = {'raja' 'I' 76 56 NaN;'bala' 'R' 12 7 56;'kavi' NaN 56 5 12}
X = find(isnan(a));
I got
??? undefined function or method 'isnan'
for input arguments of type 'cell'.

 채택된 답변

Image Analyst
Image Analyst 2016년 12월 30일

2 개 추천

Try this to examine columns 2 onwards:
a = {'raja' 'I' 76 56 NaN;'bala' 'R' 12 7 56;'kavi' NaN 56 5 12}
b = cell2mat(cellfun(@isnan, a(:, 2:end), 'UniformOutput', false))
You'll see:
a =
3×5 cell array
'raja' 'I' [76] [56] [NaN]
'bala' 'R' [12] [ 7] [ 56]
'kavi' [NaN] [56] [ 5] [ 12]
b =
3×4 logical array
0 0 0 1
0 0 0 0
1 0 0 0

댓글 수: 3

thank you
G H
G H 2017년 7월 8일
Why should we strart from the second line? "a(:, 2:end)"
Image Analyst
Image Analyst 2017년 7월 8일
Well, you can start from the first column (not line as you said), if you want to check the names for nans.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

the cyclist
the cyclist 2016년 12월 30일
편집: the cyclist 2016년 12월 30일

6 개 추천

Here is one way:
find(cell2mat(cellfun(@(x)any(isnan(x)),a,'UniformOutput',false)))
I had to stick the "any" command in there to deal with the strings, but I think this still does what you intend.

카테고리

도움말 센터File Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by