how to have a correct array format

조회 수: 2 (최근 30일)
jenny
jenny 2016년 6월 10일
댓글: jenny 2016년 6월 22일
I already set 'long g' as an array format at the variable editor preferences. However when i open the variable editor, the values for my first variable are correct, but the second variable contains values in short format. The second variable obtained after cat function. So does it relates to this? How should i change it. Thank you.
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 6월 11일
Possibly there are only 5 or so significant decimal places in the data.
Can you save the data as a .mat, including the first variable and the second variable individually?
jenny
jenny 2016년 6월 22일
yes..it's only 5 significant decimal places. Thank you Mr Walter Roberson. I think i can solve it now :)

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

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2016년 6월 10일
You can display your numbers with the format of your choice
a=12.123456789,
sprintf('%.6f',a)
  댓글 수: 1
jenny
jenny 2016년 6월 11일
The values are obtained after i run my code. First, I use sprintf to create the file name, then fscanf to read, continue with cat function to concatenate them. The values change after that.

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

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by