Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
xlsread functionality change after R2012a ?

Subject: xlsread functionality change after R2012a ?

From: Salim

Date: 6 Jul, 2013 15:30:11

Message: 1 of 4

my xls file is;

1 a 22
2 b A
3 c 44
4 d B

in matlab 2010, by using xlsread command, I obtain the output;

txt=
' ' 'a' ' '
' ' 'b' 'A'
' ' 'c' ' '
' ' 'd' 'B'
in matlab 2013, by using xlsread command, I obtain the output;
txt=
 'a' ' '
 'b' 'A'
 'c' ' '
 'd' 'B'

So everything has changed for me. If I cannot fix this difference(or bug) simply or bypass with another solution, I have to change all my files.
I want Matlab to read my files without decrease the column number.
Could you please help me about this simple problem?
Regards,

Subject: xlsread functionality change after R2012a ?

From: Yair Altman

Date: 6 Jul, 2013 17:53:10

Message: 2 of 4

"Salim" wrote in message <kr9d62$mt2$1@newscl01ah.mathworks.com>...
> my xls file is;
>
> 1 a 22
> 2 b A
> 3 c 44
> 4 d B
>
> in matlab 2010, by using xlsread command, I obtain the output;
>
> txt=
> ' ' 'a' ' '
> ' ' 'b' 'A'
> ' ' 'c' ' '
> ' ' 'd' 'B'
> in matlab 2013, by using xlsread command, I obtain the output;
> txt=
> 'a' ' '
> 'b' 'A'
> 'c' ' '
> 'd' 'B'
>
> So everything has changed for me. If I cannot fix this difference(or bug) simply or bypass with another solution, I have to change all my files.
> I want Matlab to read my files without decrease the column number.
> Could you please help me about this simple problem?
> Regards,


Read here:
http://undocumentedmatlab.com/blog/xlsread-functionality-change-in-r2012a/

Yair Altman
http://UndocumentedMatlab.com
 

Subject: xlsread functionality change after R2012a ?

From: Salim

Date: 6 Jul, 2013 19:10:26

Message: 3 of 4

I have already checked this URL. But the solution that is presented by MATLAB is not working.
When I used the command line below;
[num, txt] = xlsread('DeleteMe.xls','Sheet1','','basic');

I did not get the result that I want. It gives the same result with;
[num,txt] = xlsread('test.xls')
So I still can not see the first column of my xls file.

> Read here:
> http://undocumentedmatlab.com/blog/xlsread-functionality-change-in-r2012a/
>
> Yair Altman
> http://UndocumentedMatlab.com
>

Subject: xlsread functionality change after R2012a ?

From: Yair Altman

Date: 6 Jul, 2013 20:20:10

Message: 4 of 4

"Salim" wrote in message <kr9q32$k3n$1@newscl01ah.mathworks.com>...
> I have already checked this URL. But the solution that is presented by MATLAB is not working.
> When I used the command line below;
> [num, txt] = xlsread('DeleteMe.xls','Sheet1','','basic');
>
> I did not get the result that I want. It gives the same result with;
> [num,txt] = xlsread('test.xls')
> So I still can not see the first column of my xls file.
>
> > Read here:
> > http://undocumentedmatlab.com/blog/xlsread-functionality-change-in-r2012a/
> >
> > Yair Altman
> > http://UndocumentedMatlab.com
> >

As I wrote in that article:

As an alternative to the official workaround above, I suggest modifying the %matlabroot%/toolbox/matlab/iofun/private/xlsreadSplitNumericAndText.m function, which is responsible for the functionality change. Specifically, comment line #45:

43: % Trim the leading and trailing empties from textData
44: emptyTextMask = cellfun('isempty', textData);
45: %textData = filterDataUsingMask(textData, emptyTextMask); % Comment out this line!

This will restore the previous functionality in one go, without having to modify any user programs. Of course, we would need to redo this fix in every future Matlab release as well. Still, considering the alternatives, this appears to be the best choice in my eyes.

Yair Altman
http://UndocumentedMatlab.com
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us