data analysis

1 回表示 (過去 30 日間)
mohamed  al-asklany
mohamed al-asklany 2012 年 3 月 19 日
if i have array x and i want to get the index of maximum value of it ex:x=[1 2 3 4 5 0 11] i want command which give me that index of max(x)->7

採用された回答

Geoff
Geoff 2012 年 3 月 19 日
Use the find function:
indices = find(x == max(x));
There might be more than one maximum, so your output might be a vector. If you want just one value, use this:
index = find(x == max(x), 1);
  1 件のコメント
mohamed  al-asklany
mohamed al-asklany 2012 年 3 月 19 日
i use this code in m-file and propet win and it is run but when i used it in embeeded func in simulink it gave me error

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by