フィルターのクリア

matlab code to find the next highest integer

8 ビュー (過去 30 日間)
pavan sunder
pavan sunder 2016 年 12 月 5 日
コメント済み: Walter Roberson 2018 年 12 月 13 日
suppose i have a array a=[1 2 3 4 8 10 24] i have a random value for ex r=6;
i have to find the next highest integer to 6 in the given array i.e the output should be 8.
kindly help me with a matlab code

回答 (2 件)

KSSV
KSSV 2016 年 12 月 5 日
a=[1 2 3 4 8 10 24] ;
b = a(a>6) ;
iwant = b(1)

Jan
Jan 2016 年 12 月 5 日
a = [1 2 3 4 8 10 24];
r = 6;
b = a(find(a > 6, 1));
  2 件のコメント
shariq khan
shariq khan 2018 年 12 月 13 日
This is more precise
Walter Roberson
Walter Roberson 2018 年 12 月 13 日
slightly yes as it will not error if there were no matches .

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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by