Problems with xlsread & xlswrite, and rounding & significant figures
Show older comments
I have a slight problem with xlsread and a bigger problem with xlswrite. When I import a file I use...
[data, txt, raw] = xlsread('filename.xls');
and I get the warning...
Warning: Could not start Excel server for import, 'basic' mode will be used.
Refer to HELP XLSREAD for more information.
> In xlsread at 175
In Senspod_Data_02 at 5
.
.
Then at the end after I manipulate the data and try to create an XLS file...
Warning: Could not start Excel server for export.
XLSWRITE will attempt to write file in CSV format.
> In xlswrite at 164
In Senspod_Data_02 at 86
.
.
Fortunately, the data imports fine and I can manipulate it, though when I export, it does so as a CSV. When I open the CSV, the values are all in separate cells, but some values are rounded, and others are missing significant figures... I use 'format long because I need all of the significant figures)
1.552574520000000 (as 1.0e+5 *) in excel-csv is as 155260 (and this is supposed to be a time code)
another example is with my GPS coordinate columns... my m-file produces 0.000422188790000 (also as 1.0e+5 *), and when I open the CSV, the value is 42.219.
my output command looks like...
xlswrite('filename.xls',data);
How can I get all of the significant figures that I need in my final xls file?
Thanks.
-Adam-
4 Comments
Fangjun Jiang
on 23 May 2011
What is your Matlab version, OS and MS Office version? Here is what it says about the 'basic mode'.
This is the mode used on UNIX platforms as well as on Windows when Excel is not available as a COM server. In this mode, XLSREAD does not use Excel as a COM server, which limits import ability. Without Excel as a COM server, RANGE will be ignored and, consequently, the whole active range of a sheet will be imported. Also, in basic mode, SHEET is case-sensitive and must be a string.
Walter Roberson
on 23 May 2011
Also note that the "format long" command has no effect on anything other than things that are displayed to the command line.
Matt Tearle
on 23 May 2011
And, similarly, [apologies for the dumb question, but...] are the values actually truncated, or is that just Excel's display setting?
the cyclist
on 23 May 2011
I second Matt Tearle's comment. You can adjust the number of significant figures being displayed, using the Format menu. (You might also have it in a toolbar.)
Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!