How to know the smallest number after 0

2 ビュー (過去 30 日間)
mohd akmal masud
mohd akmal masud 2021 年 12 月 29 日
コメント済み: Voss 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
  1 件のコメント
David Goodmanson
David Goodmanson 2021 年 12 月 29 日
Hi mohd,
see 'help eps' for a list

サインインしてコメントする。

採用された回答

Voss
Voss 2021 年 12 月 29 日
The smallest uint16 number after zero is one.
  3 件のコメント
Voss
Voss 2021 年 12 月 29 日
After 0 is 1, since we are talking about the integer type uint16.
Voss
Voss 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
  1 件のコメント
mohd akmal masud
mohd akmal masud 2021 年 12 月 29 日
sir, what is [5 5 10] ?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by