필터 지우기
필터 지우기

Difference between uint8 and logical

조회 수: 13 (최근 30일)
Claire Redfield
Claire Redfield 2012년 6월 16일
1. Does matlab only make caculations with logical numbers?
2. Sometimes two matrices are in different format, such as one is logical and the other is uint8, shall we transfer the uint8 one into logical one?
3. Even if both matrices are uint8, when making caculations, does matlab still transfer them into logical ones then transfer the result back to uint8 one?

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 16일
MATLAB does not make calculations with logical numbers, except for logical tests. When a logical matrix is used in an arithmetic calculation with a numeric matrix, the logical matrix is treated as numeric.
Please put in a breakpoint in your code at the step before "f = uint8(f)" and examine the range of values in the original "f" matrix. The uint8() type conversion rounds values, so if all entries in the original "f" matrix are less than 1/2 then the result would be all 0's.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by