MATLAB: How to skip the index of array MATLABmatrix i have the index array =[1,2,1,2,4] the output matrix =[2,3,4,5,6] the second output matrix=[1,3,4,5,6] the third output matrix=[2,3,4,5,6] and so on Best Answer Alternatively,idx = [1,2,1,2,4];N = 6; % max indexout = repmat(1:N, numel(idx), 1)';out = reshape(out(out ~= idx), [], numel(idx))';The rows in out are your outputs:>> outout = 2 3 4 5 6 1 3 4 5 6 2 3 4 5 6 1 3 4 5 6 1 2 3 5 6 Related SolutionsMATLAB: Subtracting 2 matrices of different dimensions a=[1 3 4 5; 3 3 4 5; 5 5 4 5 2 4 2 6 6 5 2 6 7 2 3 1][b,idx]=unique(a(:,3:4),'rows','stable')out=a(setdiff(1:size(a,1),idx),:) MATLAB: Array manipulation such as [ 1 2 5 7 3 …. ] –> [ 1 1 1 … 2 2 2 … 5 5 5 … 7 7 7 … 3 3 3 … …. ]. repelem(A, 3) Related QuestionHi..i need to repeat rows and columns in matrix AMatrix change affect other matrixCompare 2 dimensional matrix for same pair elementsSub2ind problem for matrixSum columns of matrixHow to create a combination of matrix values in pairs
Best Answer