我已经在一列中生成了一个包含时间的数据表,在下一系列列中尝试了1-10。 我希望能够在每次尝试中提取最大值以进行进一步分析。
我试过表MGA
max = max(MGA(:, []))我得到以下错误 - “你不能只使用一个下标来下标表。表下标需要行和变量下标。”
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."
最满意答案
首先:永远不要做max = max(); ,你将超载max ,你将无法再次使用它。
要回答这个问题,您可以执行以下操作(请注意,我已将值保留在第一列中):
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 8First 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更多推荐
发布评论