How to find the maximum value by comparing 2 cells?

1 回表示 (過去 30 日間)
Struggling in MATLAB
Struggling in MATLAB 2022 年 9 月 22 日
コメント済み: Star Strider 2022 年 9 月 22 日
I have 2 cells array, for example
A = {2,4,5};
B = {1,10};
How can I find the max value (10, in this case) by comapring cell A and B?

採用された回答

Star Strider
Star Strider 2022 年 9 月 22 日
This is not as efficient as I would like it to be, however it works —
A = {2,4,5};
B = {1,10};
MaxC = max(cellfun(@(x)max([x{:}]),{A,B}))
MaxC = 10
.
  2 件のコメント
Struggling in MATLAB
Struggling in MATLAB 2022 年 9 月 22 日
Thank you!
Star Strider
Star Strider 2022 年 9 月 22 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by