Precision lost while reading from Excel file to a Matlab table

10 ビュー (過去 30 日間)
JFz
JFz 2016 年 10 月 31 日
コメント済み: Walter Roberson 2016 年 10 月 31 日
Hi,
I am using readtable to read a large high precision matrix from Excel. How to make sure I read the entire decimal points? Thanks,
Jennifer
  2 件のコメント
JFz
JFz 2016 年 10 月 31 日
I used 'Format' in readtable, but I got this error:
Invalid parameter name: Format.
dpb
dpb 2016 年 10 月 31 日
How did you determine there was a loss of precision? If the values in the spreadsheet are numeric, then by default readtable will read them as double precision which is the same as what Excel uses.
Show your work and a sample of the data...

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2016 年 10 月 31 日
readtable() will read the entire binary content that is present in Excel.
However, when you display the output of readtable, the output might not show the entire content. The output would depend upon the "format" command that is in effect.
  2 件のコメント
JFz
JFz 2016 年 10 月 31 日
Thanks. My matrix is 3000x3000 and each cell is a number with 6 decimals. But after readtable reads in the matrix, each cell becomes only 4 decimals after looking at the output of readtable. I am struggling at how to keep the 6 decimals.
Thanks,
jennifer
Walter Roberson
Walter Roberson 2016 年 10 月 31 日
This is not a matter of the readtable() 'Format' option.
At the MATLAB command line give the command
format long g
and display the table again.
The default output is "format short" which is only 4 decimal places.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by