Reading high precision data into vpa variables

조회 수: 4 (최근 30일)
Avik Sarkar
Avik Sarkar 2020년 7월 31일
답변: Raunak Gupta 2020년 11월 13일
I am trying to read data with 60 digits of precision. If I use importdata, it is imported as double data type and I am losing precision. The documentation on vpa does not really help on importing data. Is it possible to read data and store them in arbitrary precision variables? Thank you,
  댓글 수: 1
Stephen23
Stephen23 2020년 7월 31일
Import as character and convert once in MATLAB memory.

댓글을 달려면 로그인하십시오.

답변 (1개)

Raunak Gupta
Raunak Gupta 2020년 11월 13일
Hi,
As Stephen mentioned importing as double will always loose the precision because of the amount of precision is less in double. You can import the numeric values as character array. Note that even after that you can only store the values in a symbolic variable as mentioned here to not loose precision. From the character array you can convert it to cell array using cellstr and the cell array can be converted to a symbolic variable using cell2sym. This will all enable to do actual calculation on data rather than only a way to represent it.
This answer also provide some nice insights about your query.

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by