How to control number of element or number of unique element in Matrix?
1 次查看(过去 30 天)
显示 更早的评论
x= [15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 0];%Initial guess
a = unique(x); % unique elements
[countingofangles, Thetaangles] = hist(x,unique(x)); % Unique Theta and counting of theta
A = Thetaangles; % Theta used in initial guess x
c = countingofangles; %No of theta used in initial guess x
y = repmat(x,numel(a),1); %repeat x matrix
y(:,end) = a'; %replace last column by transpose(a)
output
A =
-45 -30 0 15 30 45 60 90 %Theta used in x
c =
3 3 3 3 2 3 3 2 %Number of theta corresponding to A
y =
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 -45
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 -30
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 0
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 15
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 30
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 45
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 60
15 30 45 60 -45 -30 0 90 15 30 45 60 -45 -30 0 90 15 45 60 -45 -30 90
I want to eliminate/delete that row which contains no of theta/counting of theta/angles(15,30, 45 etc) less than 3
0 个评论
采纳的回答
the cyclist
2016-2-28
I'm not 100% certain I understand your question, but I think this does what you want:
y(c<3,:) = [];
7 个评论
Image Analyst
2016-2-29
Generally you would NOT want to throw out bins at various places in the histogram. It would make it very difficult and deceiving to try to use the arrays afterwards.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!