How to know the smallest number after 0

1 view (last 30 days)
mohd akmal masud on 29 Dec 2021
Commented: Voss on 29 Dec 2021
Hi all, I have set images 3D (256x256x90 uint16), let say P. Anyone know how to know the smallest number after 0?
>> min(min(min(P)))
ans =
uint16
0
>> max(max(max(P)))
ans =
uint16
1387
David Goodmanson on 29 Dec 2021
Hi mohd,
see 'help eps' for a list

Voss on 29 Dec 2021
The smallest uint16 number after zero is one.
3 CommentsShow 1 older commentHide 1 older comment
Voss on 29 Dec 2021
After 0 is 1, since we are talking about the integer type uint16.
Voss on 29 Dec 2021
If you want to find the smallest number greater than 0 that is in your image data, you can do this:
min(P(P > 0))

Chunru on 29 Dec 2021
P = randi([0 65535], [5 5 10], 'uint16'); % smaller size for demonstration
P1 = P(:);
min(P1(P1>0))
ans = uint16 141
mohd akmal masud on 29 Dec 2021
sir, what is [5 5 10] ?

Categories

Find more on Image Arithmetic in Help Center and File Exchange

R2021b

Community Treasure Hunt

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

Start Hunting!