Borrar filtros
Borrar filtros

Difference between uint8 and logical

13 visualizaciones (últimos 30 días)
Claire Redfield
Claire Redfield el 16 de Jun. de 2012
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Jun. de 2012
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.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by