From: Walter Roberson on
Matteo wrote:

> I think a better suited question for my case would be: Is there any way to automatically detect if the input matrix of raw data (which is in double format, by the way) does not have the range of values that would normally be expected for an intensity image (0 to 1)? And if so, convert it to that scale using mat2gray.
> For instance, one of my matrices have data between negative 5.9834 and positive 2.9969.

if any(abs(MatrixName(:)) > 1)
From: Matt Fig on
if any(A(:)<0 | A(:)>1)

From: Walter Roberson on
Matt Fig wrote:
> if any(A(:)<0 | A(:)>1)

Ah, yes, you are correct, Matt... I got caught mentally thinking of the
valid range for normalized sound files.
From: Matteo on
Thank you both, this is very helpful!
:-)