find max value in a matrix
1 次查看(过去 30 天)
显示 更早的评论
I have a=[ 1 2 3; 7 8 9; 4 5 6; 2 1 3]. I want to find max value in the matrix 'a' but i don't want it to consider second row. So I should get 6 as the answer. How to do it?
0 个评论
回答(1 个)
Star Strider
2015-2-22
This works:
a=[ 1 2 3; 7 8 9; 4 5 6; 2 1 3];
a_134 = a([1 3 4],:);
max_a134 = max(a_134(:));
2 个评论
Star Strider
2015-2-22
In that instance, just nest two max calls:
max_a134 = max(max(a([1 3 4],:)))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!