Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Precision problem with xlsread
Replies: 1   Last Post: Feb 19, 2013 10:12 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: Precision problem with xlsread
Posted: Feb 19, 2013 10:12 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Qian Ma" <mqpaul@live.cn> wrote in message
news:kftmbe$kgh$1@newscl01ah.mathworks.com...
> "Marat Mamat" wrote in message <hhq09c$ibs$1@fred.mathworks.com>...
>> I have data such as this in an excel sheet. The number of rows and
>> columns can get get bigger (few hundreds). 0.000000000000
>> 363.548604178313 485.186546083050
>> 363.548604178313 0.000000000000 202.195421560430
>> 485.186546083050 202.195421560430 0.000000000000
>> 891.253733175912 535.522317088653 539.651284812702
>> 1026.191509271050 673.810725723478 677.908273588691
>>
>> I want process this and for that it needs to be in a matrix with the
>> format and precision preserved. I tried the Import Data GUI utility,
>> which appears to gives me result to 4 decimal places (but when I copy the
>> cell the entire value is present).
>>
>> I tried xlsread('file.xls'). Below is what I get:
>> 1.0e+003 *
>>
>> 0 0.3635 0.4852
>> 0.3635 0 0.2022 0.4852 0.2022 0 0.8913
>> 0.5355 0.5397
>> 1.0262 0.6738 0.6779
>>
>> I a previous post on xlswrite,
>> http://www.mathworks.com/matlabcentral/newsreader/view_thread/267281 a
>> similar problem which wrongly placed decimal point is mentioned. But I
>> don't know how to solve this. I also tried to convert to csv format
>> first, but the same problem persists. How do I use num2str to solve this?
>> Or can it be used?

>
> REPLY FROM QIAN:
> Hi, Marat,
>
> I think I found a solution for your problem. Before writing the command
> "xlsread", you can first input "format long", and then do the "xlsread".
> This will import as many as 16 digits from your excel file.


XLSREAD will read the data stored in your Excel file to full precision
(since I don't believe Excel has a 128-bit integer format or quad precision
floating-point or anything like that) regardless of the FORMAT setting. All
"format long" does is control how the data is _displayed_ in the Command
Window; it has no effect whatsoever on how the data is actually _stored._

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.