How to know the smallest number after 0

3 次查看(过去 30 天)
mohd akmal masud
mohd akmal masud2021-12-29
评论: _ ,2021-12-29
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

采纳的回答

_
_ 2021-12-29
The smallest uint16 number after zero is one.
  3 个评论
_
_ 2021-12-29
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))

请先登录,再进行评论。

更多回答(1 个)

Chunru
Chunru 2021-12-29
P = randi([0 65535], [5 5 10], 'uint16'); % smaller size for demonstration
P1 = P(:);
min(P1(P1>0))
ans = uint16 141

Community Treasure Hunt

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

Start Hunting!

Translated by