フィルターのクリア

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