MATLAB: HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING image processingmatrix arraynoise reduction how to move the array 1 4 6 8 2 37 9 5 all elements are move diagonally one pixel for m*n matix Best Answer I = [ 1 4 6 8 2 3 7 9 5]; % initial arrayidx = reshape(1:numel(I),size(I));for jj = -size(I,1) + 2 : size(I,2) - 2 a = diag(idx,jj); I(a) = I(circshift(a,1));end Related SolutionsMATLAB: HOW TO MOVE THE ELEMENTS BACK IN ORDER IN MATRICS WHICH ARE BEEN MOVED DIAGONALLY Are you asking how to undo what your code does?for jj = -size(I,1) + 2 : size(I,2) - 2 a = diag(idx,jj); I(a) = I(circshift(a,-1)); % Note the -1end MATLAB: HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING I = [1 2 42 5 61 3 8 ];ii = 1:size(I,1)+1:numel(I);I(ii) = I(ii(mod(ii - 2,3)+1));orI(eye(size(I))>0) = circshift(diag(I),1); Related QuestionMatrix change affect other matrixHow to find a subset matrix in the main matrix and build a new matrixHow to swapping values in matrix rowRead Excel sheet (one after other )
Best Answer