你说的列到底是指什么?
a=[2 3;3 6;4 9]是三行两列,
a =
2 3
3 6
4 9
如果你要得到b =
4 9
则程序为
a=[2 3;3 6;4 9] 或者 a=[2 3;3 6;4 9]
b=max(a) b=max(a,[],1)
如果要得到
b =
3
6
9
则程序为:
a=[2 3;3 6;4 9]
b=max(a,[],2)
max具体用法可以见使用help max命令
help max
MAX Largest component.
For vectors, MAX(X) is the largest element in X. For matrices,
MAX(X) is a row vector containing the maximum element from each
column. For N-D arrays, MAX(X) operates along the first
non-singleton dimension.
[Y,I] = MAX(X) returns the indices of the maximum values in vector I.
If the values along the first non-singleton dimension contain more
than one maximal element, the index of the first one is returned.
MAX(X,Y) returns an array the same size as X and Y with the
largest elements taken from X or Y. Either one can be a scalar.
[Y,I] = MAX(X,[],DIM) operates along the dimension DIM.
When X is complex, the maximum is computed using the magnitude
MAX(ABS(X)). In the case of equal magnitude elements, then the phase
angle MAX(ANGLE(X)) is used.
NaN's are ignored when computing the maximum. When all elements in X
are NaN's, then the first one is returned as the maximum.
Example: If X = [2 8 4 then max(X,[],1) is [7 8 9],
7 3 9]
max(X,[],2) is [8 and max(X,5) is [5 8 5
9], 7 5 9].
[本帖最后由 dolphinscut 于 2010-6-4 23:48 编辑]