More efficient alternative to find()

1 回表示 (過去 30 日間)
Chun Hei Chan
Chun Hei Chan 2023 年 8 月 4 日
コメント済み: Chun Hei Chan 2023 年 8 月 4 日
Hello,
I am working on some simulation data and I would like to find the maximum element in each randomly generated vector which has no inherent pattern. Is there any more efficient alternative to the find() function in this case since Profiler says that find() is taking up a significant proportion of the compile time.
Many thanks.

採用された回答

John D'Errico
John D'Errico 2023 年 8 月 4 日
編集済み: John D'Errico 2023 年 8 月 4 日
Why does max not do what you want? There are TWO returns from max.
X = randi(100,[1,10])
X = 1×10
56 1 14 16 99 73 73 55 89 95
[xmax,maxloc] = max(X)
xmax = 99
maxloc = 5
  1 件のコメント
Chun Hei Chan
Chun Hei Chan 2023 年 8 月 4 日
Thanks for the tip!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by