MATLAB: Finding minimum value in multi dimensional cell array

cell array and the min command

I'm going through a book trying learn this program on my own. With that said, I have a basic question to ask. I have this 5 dimensional cell array and I can not figure out how to find the minimum value in the (2,2,1:5) positions. So, If A(:,:,5) has the lowest value of 1, how can I display that 2X2 matrix? Thanks for your help!
A(:, :, 1) = { 'A' 'B' ; 'C' 5};
A(:, :, 2) = { 'E' 'F' ; 'G' 4};
A(:, :, 3) = { 'H' 'I' ; 'J' 3};
A(:, :, 4) = { 'L' 'M' ; 'N' 2};
A(:, :, 5) = { 'O' 'P' ; 'Q' 1};

Best Answer

Trying to perform numeric operations on a cell array is usually pointlessly complicated, so the first thing to do is to put that numeric data into a numeric array. Then your task is trivially easy:
>> V = [A{2,2,:}]
V =
5 4 3 2 1
>> [val,idx] = min(V)
val = 1
idx = 5
>> A(:,:,idx)
ans =
'O' 'P'
'Q' 1
Read this to understand how the first line of code works: