position of maximum in matrix
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I'm going to find the position of maximum value in every column of a matrix
0 件のコメント
回答 (3 件)
John
2012 年 7 月 10 日
編集済み: John
2012 年 7 月 10 日
Let's say
A = [1 2 3; 4 5 6; 7 8 9];
[row,columns] = size(A); index_matrix = zeros(1,columns)
for i = 1:columns
[large,index] = max(:,i);
index_matrix(i) = index;
end
%The index_matrix vector should store the position of the max value of each column
0 件のコメント
per isakson
2012 年 7 月 10 日
Help says:
C = max(A,[],dim) returns the largest elements along the dimension
of A specified by scalar dim. For example, max(A,[],1) produces the
maximum values along the first dimension of A.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!