how to find matrix indices
1 次查看(过去 30 天)
显示 更早的评论
k=1:2; t=1:2; x(k,t)=[1.2 1.3;1.8 1.5] max(x) I have entered input x and found max(x).For what value of k and t , x is maximum ?How to find this using matlab code?
0 个评论
采纳的回答
Wayne King
2013-3-8
编辑:Wayne King
2013-3-8
Do you want the single biggest element in the matrix? If so then, just max() will not give you that. You'll get a row vector of the largest elements in each column.
X = [1.2 1.3;1.8 1.5];
[val,idx] = max(X(:));
[I,J] = ind2sub(size(X),idx);
X(I,J)
is the largest element.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!