Effacer les filtres
Effacer les filtres

How to find the maximum value by comparing 2 cells?

2 vues (au cours des 30 derniers jours)
Atanu
Atanu le 22 Sep 2022
Commenté : Star Strider le 22 Sep 2022
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?

Réponse acceptée

Star Strider
Star Strider le 22 Sep 2022
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 commentaires
Atanu
Atanu le 22 Sep 2022
Thank you!
Star Strider
Star Strider le 22 Sep 2022
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by