MATLAB: Dynamic Loop with for MATLAB and Simulink Student Suite Dynamic Loop Best Answer N = [6 44 ; 170 179 ; 198 203] ;iwant = cell(size(N,1),1) ;for i = 1:size(N,1) for j = N(i,1):N(i,2) iwant{i} = [iwant{i} j] ; % just demo to show the variables after loop endendiwant{1}iwant{2}iwant{3} Related SolutionsMATLAB: Auto split matrix into other matrices (up to n) A = [1 55 14 1 1 12 55 14 1 1 15 35 13 1 1 26 35 12 1 1 27 35 11 2 2 38 35 11 2 2 3];C = A(:,end) ; [c,ia,ib] = unique(A(:,end)) ;N = length(c) ;iwant = cell(N,1) ;for i = 1:N iwant{i} = A(ib==i,:) ; end MATLAB: Delete rows when a value repeated less than 5 times m = [1 201 12 202 13 203 14 204 15 205 16 206 17 207 28 208 29 209 210 210 211 222 312 232 3];% Unique elements and locations in third column[uv, ~, id] = unique(m(:,3));% How many of each?n = histcounts(id);% Keep ones with more than 5.m2 = m(ismember(m(:,3), uv(n>=5)),:) Related QuestionGroup a Array ElementsTransfer from fix array to another array
Best Answer