I have generated a table of data with time in one column with attempts 1-10 in the next series of columns. I want to be able to extract the max value in each attempt for further analysis.
I have tried for table MGA
max = max(MGA(:, []))
I get the following error -- "You cannot subscript a table using only one subscript. Table subscripting requires both row and variable subscripts."
First off: Never do max = max();
, you'll overload max
, and you won't be able to use it again.
And to answer the question, you can do as follows (notice that I've kept the values in the first columns):
MGA
MGA =
1 5 3 8 9
2 4 7 3 3
3 8 7 6 9
4 8 2 7 3
5 2 2 9 10
6 5 5 10 4
7 5 10 6 2
8 7 4 2 3
9 8 6 2 7
10 8 3 3 5
max_values = [MGA(:,1), max(MGA(:,2:end),[],2)]
max_values =
1 9
2 7
3 9
4 8
5 10
6 10
7 10
8 7
9 8
10 8