find the largest (or smallest) element in any cell array, nested or not
Updated 6 May 2014

View License

%find the largest/smallest element among all the elements in a cell array. The cell array can have matrix or a cell array or any combination of these two. The functions use recursion.
%there is a maxC and a minC in the zip file.
%f=@() randi(100) %just to type faster the following
%a={{{ [f() f(); f() f()]} {f()} [f() f() f()]}; [f() f() f()]};
%notice some difference with the normal max/min, even with simple matrix:
%a=[1 2 3; 4 5 6];
%ans= 4 5 6
%maxC(a)= 6, as expected.

Cite As

Valerio Biscione (2024). (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Data Types in Help Center and MATLAB Answers

Inspired: Quantile Probability Plot

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

little mistake in the description, max(a) instead of maxC(a)