フィルターのクリア

finding the maximum of values after and before a specific value

6 ビュー (過去 30 日間)
SSG_newbiecoder
SSG_newbiecoder 2017 年 12 月 19 日
コメント済み: SSG_newbiecoder 2017 年 12 月 22 日
hello, I have a doubt.Is it possible to find out the maximum values before and after the ith element in an array?
  2 件のコメント
Adam
Adam 2017 年 12 月 19 日
編集済み: Adam 2017 年 12 月 19 日
yes
max( array( ( i + 1 ):end ) )
max( 1:( i - 1 ) )
SSG_newbiecoder
SSG_newbiecoder 2017 年 12 月 22 日
Thanks Adam

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

採用された回答

Birdman
Birdman 2017 年 12 月 19 日
One approach:
a=randi([1 10],1,10);
ind=4;%4th element in a vector is chosen
a1=a(1:ind-1);
a2=a(ind+1,end);
max(a1)
max(a2)
  1 件のコメント
SSG_newbiecoder
SSG_newbiecoder 2017 年 12 月 22 日
Thank you. If anybody is using this please note that
a2=a(ind+1:end);

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by