find local max in a matrix
4 次查看(过去 30 天)
显示 更早的评论
Hello.I have this matrix
A=[116 3;107 6;114 6;119 6;117 9;120 9;108 15
;113 18;115 18;112 21;111 24]
.I want to detect local maximums from second column and where local max happened that row should be kept in a new matrix. here (112 21) & (111 24) should be saved in matrix B. can any one help me plz?
1 个评论
回答(1 个)
Image Analyst
2016-2-22
You can get the local max with imdilate():
A=[116 3;107 6;114 6;119 6;117 9;120 9;108 15
;113 18;115 18;112 21;111 24]
windowSize = 3;
maxCol2 = imdilate(A(:,2), true(windowSize, 1))
I'm not sure why you have only two rows instead of local max for every row.
0 个评论
另请参阅
类别
在 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!