Automaticlly converting negative values to 0
이전 댓글 표시
Hey. This is my code.
Ex_UpperBar * Ey_UpperBar * image(x_LowerBar,y_LowerBar)
Ex_UpperBar * Ey_UpperBar
ans =
-1
image(x_LowerBar,y_LowerBar)
ans =
uint8
89
but it is giving the Answer:
Ex_UpperBar*Ey_UpperBar*image(x_LowerBar,y_LowerBar)
ans =
uint8
0
It is supposed to return -89. How do i fix it? Thanks
채택된 답변
추가 답변 (2개)
Sulaymon Eshkabilov
2020년 5월 18일
편집: Sulaymon Eshkabilov
2020년 5월 18일
0 개 추천
uint8 cannot store -89 and thus, 0
Thus, store your data in int8 or better int16.
Sulaymon Eshkabilov
2020년 5월 18일
0 개 추천
Store you data in int8 or int16
댓글 수: 2
Abad Ch
2020년 5월 18일
Walter Roberson
2020년 5월 18일
int16(Ex_UpperBar)*int16(Ey_UpperBar)*int16(image(x_LowerBar,y_LowerBar))
카테고리
도움말 센터 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!