why does xlsread deletes NaN for cells with text?

when applying xlsread for an excel sheet with both numbers and text, xlsread deletes the cells that contains text instead of writing NaN. How can i avoid this? I want it to write NaN so i can use isnan()=0

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2013년 3월 4일
편집: Andrei Bobrov 2013년 3월 4일

0 개 추천

use
[~,~,c] = xlsread(...)
eg
[~,~,c] = xlsread('yourfile.xlsx')
out = zeros(size(c))
lc = cellfun(@(x)ischar(x),c);
out(lc) = nan;
out(~lc) = [c{~lc}];

이 질문은 마감되었습니다.

태그

질문:

2013년 3월 4일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by