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!