How to find the maximum value by comparing 2 cells?

1 visualización (últimos 30 días)
Atanu
Atanu el 22 de Sept. de 2022
Comentada: Star Strider el 22 de Sept. de 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?

Respuesta aceptada

Star Strider
Star Strider el 22 de Sept. de 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
.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by