element in 2D array

3 views (last 30 days)
Umair Altaf
Umair Altaf on 5 Feb 2013
how can find minimun element in 2D array

Accepted Answer

Walter Roberson
Walter Roberson on 5 Feb 2013
Edited: Walter Roberson on 5 Feb 2013
[minval, minpos] = min(YourArray(:));
[minrow, mincol] = ind2sub(size(YourArray), minpos);
The above if you want to know the row and column as well as the value. If you just want the value then
minval = min(YourArray(:));

More Answers (1)

James Tursa
James Tursa on 5 Feb 2013
Not exactly sure what you want, but here is code to find the minimum value:
x = rand(2,2);
m = min(x(:));

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!