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
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by