MATLAB: Accessing var content in column, not location

I have a matrix of values with 4 columns. The left column is time in hrs. I am trying to find the max and min of the columns 2:4 and identify the time at which they occur, not the location.
(all is the name I defined for time and the temps)
all =
0 84.3000 90.0000 86.7000
2.0000 86.4000 89.5000 87.6000
4.0000 85.2000 88.6000 88.3000
6.0000 87.1000 88.9000 85.3000
8.0000 83.5000 88.9000 80.3000
10.0000 84.8000 90.4000 82.4000
12.0000 85.0000 89.3000 83.4000
14.0000 85.3000 89.5000 85.4000
16.0000 85.3000 88.9000 86.3000
18.0000 85.2000 89.1000 85.3000
20.0000 82.3000 89.5000 89.0000
22.0000 84.7000 89.4000 87.3000
24.0000 83.6000 89.8000 87.2000
I have been successful in finding the max and the location
[max_val,time_at] = max(all(:,2:4))
but the output is
max_val =
87.1000 90.4000 89.0000
time_at =
4 6 11
which returns the position in the first column, not the hour the max occurred. Any ideas how to modify for the time?

Best Answer

Bad idea to name a variable 'all' as you will mask the ALL function!
A =[0 84.3000 90.0000 86.7000
2.0000 86.4000 89.5000 87.6000
4.0000 85.2000 88.6000 88.3000
6.0000 87.1000 88.9000 85.3000
8.0000 83.5000 88.9000 80.3000
10.0000 84.8000 90.4000 82.4000
12.0000 85.0000 89.3000 83.4000
14.0000 85.3000 89.5000 85.4000
16.0000 85.3000 88.9000 86.3000
18.0000 85.2000 89.1000 85.3000
20.0000 82.3000 89.5000 89.0000
22.0000 84.7000 89.4000 87.3000
24.0000 83.6000 89.8000 87.2000]
[Mx,Imx] = max(A(:,2:4));
[Mn,Imn] = min(A(:,2:4));
MXtime = A(Imx,1) % This holds the times at the max.
MNtime = A(Imn,1) % This holds the times at the min.