How to get back real value after rounding

조회 수: 2 (최근 30일)
Med Future
Med Future 2022년 12월 16일
답변: Steven Lord 2022년 12월 16일
Hello, I have the value 3.3 and 0.5, when I apply my algorithim i round the value to 3.3 to 3 and 0.5 to 1.
I want to get back the real value 3.3 and 0.5 after rounding. How can i do that in MATALAB.

채택된 답변

Steven Lord
Steven Lord 2022년 12월 16일
Unless you've stored those un-rounded values in a variable that still exists, you can't.
Suppose I tell you I bought two items A and B from the store, and that their prices (rounded to the nearest dollar) are each $3. Is item A or item B more expensive? With just the information I gave you that question is impossible to answer. You'd need something else, like a peek at my receipt (which would have the original prices, and in this case would correspond to having a backup copy of the original data in a separate variable) to answer that question.

추가 답변 (1개)

Arif Hoq
Arif Hoq 2022년 12월 16일
a=[3.3 0.5];
round_vector=round(a)
round_vector = 1×2
3 1
c=a-round_vector;
origin_vector=round_vector+c
origin_vector = 1×2
3.3000 0.5000

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by