Please tell me how i can find first three minimum elements in each column of a matrix?
3 次查看(过去 30 天)
显示 更早的评论
Please tell me how i can find first three minimum elements in each column of a matrix?
0 个评论
回答(1 个)
Andrei Bobrov
2016-2-12
编辑:Andrei Bobrov
2016-2-12
A - your matrix.
X = sort(A);
out = X(1:3,:);
or
z = sort(A);
x = diff(z)~=0;
y = [cumsum(x).*x;zeros(1,size(A,2))];
out = reshape(z(y > 0 & y <=3),3,[]);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Detection, Range and Doppler Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!