How to round only two values after decimal point

조회 수: 3 (최근 30일)
Akshay Math
Akshay Math 2020년 3월 1일
댓글: stozaki 2020년 3월 1일
Hi guys,
I have following block set up and i want 24.02==24.021 but i am getting output as 0 so how can i round the input to consider only two values after decimal point.

채택된 답변

Akshay Math
Akshay Math 2020년 3월 1일
First multiply with 100 for two values after decimal then convert into integer and divide by 100.

추가 답변 (1개)

stozaki
stozaki 2020년 3월 1일
You can use 'round' block and 'subtract' block.
  댓글 수: 4
Akshay Math
Akshay Math 2020년 3월 1일
Thanks stozaki, however this worked for me
First multiply with 100 for two values after decimal then convert into integer and divide by 100.
stozaki
stozaki 2020년 3월 1일
@ Akshay
Thank you for trying the data type conversion block. I understand that the location of the binary points was different because you were using a Gain block.
Regards,
stozaki

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

카테고리

Help CenterFile Exchange에서 Measurements and Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by