MATLAB: Automaticlly converting negative values to 0

unsigned integers

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

Best Answer

  • Use a command int8() or int16() to store your processed data that resolves your task. e.g.: a= -89; b=int8(a)