The data precision in readtable function

49 Ansichten (letzte 30 Tage)
JFz
JFz am 26 Okt. 2015
Bearbeitet: Kirby Fears am 27 Okt. 2015
I am using readtable to read in a Excel sheet into a table object. The numbers in the spreadsheet are of 12 decimal digits, but after readtable, the numbers become 5 digits only. Why? And how to make the digits longer?
Thanks,
Jennifer

Antworten (1)

Kirby Fears
Kirby Fears am 26 Okt. 2015
Bearbeitet: Kirby Fears am 26 Okt. 2015
Hi Jennifer,
The data is being displayed with 5 significant digits in your Matlab workspace. However, the data is most likely stored with 12 significant digits.
Try displaying in the "long" format, then print out or inspect your data again.
format long
Note that this does not change the way data is stored in Matlab, but instead changes how it is displayed to you.
Hope this helps.
  3 Kommentare
Peter Perkins
Peter Perkins am 26 Okt. 2015
Jennifer, what Kirby described is how things should behave. So if it's not, you're going to have to attach a short example of a file where this happens, and perhaps even a screen shot, to demonstrate what you're seeing.
Kirby Fears
Kirby Fears am 27 Okt. 2015
Bearbeitet: Kirby Fears am 27 Okt. 2015
You don't need to read the table again. Just input the following code with Test1 in your workspace.
format long;
Test1
This will display Test1 in long format in your Command Window.
You can also go into the variable viewer, open up Test1, then double-click on a specific number. Your cursor will be in "edit" mode inside the cell, and it will show full precision digits.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by