anyone can help me how to find the oldest person in a room?
8 ビュー (過去 30 日間)
古いコメントを表示
anyone can help me how to find the oldest person in a room?
i have write code :
old_name=name(max(age))
first access the max age the pass it to the name to get the name of oldest man.
is it true or not??
please guide me
Thanks in advance
0 件のコメント
採用された回答
Cris LaPierre
2020 年 7 月 26 日
No. This returns the persons age. You want the index, so you'll have to do this in 2 steps. See the documentation for max to see how to get the index of the max value.
1 件のコメント
Cris LaPierre
2020 年 7 月 26 日
One thing to be aware of: if there are multiple people with max age, this will return the first one only. You can use logical indexing to extract all entries that match your condition
name(age==max(age)).
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!