Hi,
I calculate with matrices of type uint16 recorded by cameras. But I've got a general problem with the calculation especially by fraction. Example:
A=[8 9 2; 9 6 5; 1 0 9]; % class double B= uint16(A); % class uint16
A/10=[0.8 0.9 0.2; 0.9.0.6 0.5; 0.1 0 0.9] B/10=[1 1 0; 1 1 0; 0 0 1 ]
Can anybody explain me the results ? The values seems to be rounded up. Thanks for support.

 채택된 답변

José-Luis
José-Luis 2014년 6월 26일
편집: José-Luis 2014년 6월 26일

0 개 추천

When you divide an integer, it will produce an integer and just ignore the decimal part. For instance 3/2 will produce 1. If you want the decimal value, please use:
double(A) / double(B)

댓글 수: 1

Jan
Jan 2014년 6월 26일
편집: Jan 2014년 6월 26일
Thanks for fast support. So it is a exemplary casting problem as in java.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

Jan
2014년 6월 26일

편집:

Jan
2014년 6월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by