You can multiply that 0-1 value by the max for the integer type:
maxValue = intmax('uint8') % or...
maxValue = intmax('uint16')
grayLevelThreshold = maxValue * grayThreshValue;
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!