number format comparison difficulty

Hello everyone!!
Here is my problem. Matlab considers that 3.9438e+04 and 39438 are not the same!! How may I fix this? What conversion should I make?
Thank you, Vanessa

댓글 수: 2

Geoff Hayes
Geoff Hayes 2017년 7월 27일
Vanessa - please clarify what you mean by MATLAB not considering these two numbers to be the same. Are you trying to perform some equality check and that is failing? Or is it that visually they don't appear the same in the command window? (In which case you can format the data using Set Command Window output display format.
It works for me:
>> 3.9438e+04 == 39438
ans = 1
"Matlab considers that 3.9438e+04 and 39438 are not the same"
Most probably those two variables do not have the same values. Have you tried viewing the numbers at a higher precision, e.g. by changing the format or using sprintf ?

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Graphics Objects에 대해 자세히 알아보기

태그

질문:

2017년 7월 27일

댓글:

2017년 7월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by