MATLAB xlswrite function

Hello all MATLAB users:
This came to my attention,
>> x = [inf 3 4 inf];
>> xlswrite('test',x,'test');
if you open the .xls file you will notice that the inf value in xls is the "magic" number 65535.
Does anyone know the reason?

 Accepted Answer

Sean de Wolski
Sean de Wolski on 28 Jan 2011

0 votes

Because 2^16-1 is the largest number Excel can represent since it's 16 bit unsigned.

2 Comments

Don't you mean unsigned 16 bit? ;)
Oops, yup.

Sign in to comment.

More Answers (2)

Kenneth Eaton
Kenneth Eaton on 28 Jan 2011

1 vote

The reason? Because the documentation says so! ;)
Excerpt:
  • Excel converts Inf values to 65535. MATLAB converts NaN values to empty cells.

Community Treasure Hunt

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

Start Hunting!