필터 지우기
필터 지우기

How to avoid the rounding off of data ?

조회 수: 40 (최근 30일)
Mahesh Babu Dhanekula
Mahesh Babu Dhanekula 2020년 9월 30일
댓글: Steven Lord 2020년 9월 30일
I am trying to perform the following divison operation.
l = 2.093750000000000e+09;
l/10^9
It was giving the output as:
ans =
2.0938
But i need the output as 2.09375 only. How an i achieve it ? I want to use it in further calculations as 2.09375 only. Is there any way to achieve this ?
l = 2.187500000000000e+09;
l/10^9
This was giving desired output in this case.
ans =
2.1875
If anybody knows how to solve this, please share your thoughts.

답변 (1개)

Arthur Roué
Arthur Roué 2020년 9월 30일
편집: Arthur Roué 2020년 9월 30일
There is no problem here, the default display format is set to short. Try :
format long
l = 2.093750000000000e+09;;
l/10^9
ans =
2.093750000000000
You can also access to the variable with the variable inspector : just double click on your variable in the workspace explorer.
  댓글 수: 5
Mahesh Babu Dhanekula
Mahesh Babu Dhanekula 2020년 9월 30일
Thanks for reading my 2 questions. This is exactly what i needed steven.
I have a number 2.093750000000000e+09, and I want to to covert this into 2.09375Hz. So how can i do this ?
If there is any way, please let me know steven
Steven Lord
Steven Lord 2020년 9월 30일
Use fprintf or num2str to create a string or char vector with the desired format then concatenate it with the string "Hz" using +.

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

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by