MATLAB: Pad a vector to get matrix rotate vector to get circular geometry I have a matrix A like above, how I can get matrix B as result of rotated matrix A in space? Best Answer A=[10 12 3 34 5]B=A(1,1)numel(A)for i=2:1:numel(A) B=padarray(B,[1,1],A(1,i))end Related SolutionsMATLAB: Creating an Array with nested for loops. A = 1:4;m = numel(A);[ii,jj] = ndgrid(1:2*m-1);out = A(max(abs(ii-m),abs(jj-m))+1);orm = numel(A);s = zeros(2*m-1);s(m,m) = 1;out = A(bwdist(s,'chessboard')+1);or with for..end loopm = numel(A);out = zeros(2*m-1);for jj = 1:m out(jj:m*2-jj,jj:m*2-jj) = A(m + 1 -jj);end MATLAB: Performing without randperm function A=imread('dock.jpg');A=rgb2gray(A);A=imresize(A,[256 256])A=double(A)n = numel(A);A1_10 = repmat(A,[1,1,10]);t = ones(size(A));for j1 = 1:size(A1_10,3) p = t; p(randi(n,6000,1)) = 0; A1_10(:,:,j1) = A1_10(:,:,j1).*p;endA1_10 Related QuestionElements processing in arrayHow to convert Cell Array index into Matrix with onesMatrix from an arrayInsert zeros in a vectorMaking the value as 0Preallocate an matrix in 2 for loops
Best Answer