MATLAB: Matrix matrix how I can remove rows from matrix each elements in these rows are equals m=[1 2 3;1 1 1;4 5 8;4 5 8;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;4 5 8;7 8 5; 47 9 5;7 8 5;5 322 5;7 8 55]; Best Answer m=[1 2 3;1 1 1;4 5 8;4 5 8;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;1 1 1;4 5 8;7 8 5; 47 9 5;7 8 5;5 322 5;7 8 55];variant 1[a b n] = unique(m,'rows','first');[id id] = sort(b);out1 = a(id,:);variant 2[a b n] = unique(m,'rows','first');[id id] = sort(b);t = accumarray(n,ones(numel(n),1)) == 1;a2 = a(id,:);out2 = a2(t(id),:); Related SolutionsMATLAB: Error using griddedInterpolant The grid vectors do not define a grid of points that match the given values. You have 20 Y samples, but your V has 21 rows.>> whos X Y V Name Size Bytes Class Attributes V 21x41 6888 double X 1x41 328 double Y 1x20 160 double MATLAB: Call all element inside cell (this cell contain another set of cells) [cell_A{:}] Related QuestionHow to find matching rows between two matrices and and retrieve a value to be applied to the matched rowHow to reassign the labelReplacing row number with valueHow to create a new matrix with some known rows
Best Answer