MATLAB: How to control number of element or number of unique element in Matrix

arrayMATLABmatrix array

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

Best Answer

I'm not 100% certain I understand your question, but I think this does what you want:
y(c<3,:) = [];