I'm trying to Import an xls file which has numeric as well as string data in it. Now I want the Output to be a cell
-array consisting of strings only.
I used
[numeric,text,raw]=xlsread('myFile.xls');
to read the file. Now I'm looking for a way to convert all cells of raw
into strings
. I actually solved the problem using
raw=cellfun(@convertmat2char,raw);
function charData = convertmat2char(data)
if isnumeric(data)
charData={num2str(data)};
else
charData={data};
end
end
but this is ridiculously slow. I guess this can be done in a pretty easy matrix operation, but I don't seem to be able to figure out how.