Matlab xlsread function

I have 'data.xlsx' file with cells of numbers and letters.

when I run this command:

 [num,txt,raw] = xlsread('data.xlsx');

I got:

num =

NaN   NaN   NaN  
NaN   NaN     6  
NaN   NaN   NaN  
  4   NaN   NaN  

txt = 

'a'    'd'    'g'
'b'    'e'    '' 
'c'    'f'    'h'
''     ''      ''

there is a way to get a new variable which will contain both? something like:

raw =

'a'    'd'    'g'
'b'    'e'    '6' 
'c'    'f'    'h'
'4'     ''      ''

maybe by using num2str?

I solved my problem, thanks all

in yuk's solution, I got:

p.s. my version is Matlab 2010a.


[~,~,raw] = xlsread('data.xlsx');
%# find numbers
containsNumbers = cellfun(@isnumeric,raw);
%# convert to string
raw(containsNumbers) = cellfun(@num2str,raw(containsNumbers),'UniformOutput',false);

In addition to Alon's solution that will contain cells with 'NaN' strings if those cells are empty in the input file.

Just add after xlsread:

containsNaNs = cellfun(@isnan,raw);
raw(containsNaNs) = {''};

Need Your Help

What does this script means

bash shell command-prompt

I am new to scripting and I found following expression in a script.

MS Access Data Access Limitations

database ms-access concurrency data-access

I have a project right now where I'd like to be able to pull rows out of an Access database that a 3rd party product uses to store its information. There will likely be a small number of users hit...