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

Answers (1)

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}];

This question is closed.

Tags

Asked:

on 4 Mar 2013

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!