From: Aishwarya on 21 Jul 2010 17:29 Hello All, I want to translate a matrix spatially up and down.The following code worked for translating the matrix right and left but I am stuck with doing the up and down translation.Kindly help. i=1; fid = fopen('Src4Det5.bin','r+'); a = fread(fid,'double'); a=reshape(a,120,120); figure,imagesc(a); a=reshape(a,1,14400); b=zeros(size(a)); for j=1:size(a(:))-3000 b(j)=a(j+3000); end A_MCP(i,:) = b; size(b) b=reshape(b,120,120); figure,imagesc(b);
From: Walter Roberson on 21 Jul 2010 18:03 Aishwarya wrote: > I want to translate a matrix spatially up and down.The following code > worked for translating the matrix right and left but I am stuck with > doing the up and down translation.Kindly help. > > i=1; > fid = fopen('Src4Det5.bin','r+'); > a = fread(fid,'double'); > a=reshape(a,120,120); > figure,imagesc(a); > a=reshape(a,1,14400); > b=zeros(size(a)); > for j=1:size(a(:))-3000 > b(j)=a(j+3000); > end > A_MCP(i,:) = b; > size(b) > b=reshape(b,120,120); > figure,imagesc(b); You asked the same question the other day but did not reply to the comments given then. B1 = horzcat(zeros(K,size(a,2)).A) would have "A" as its right-hand side, moved right by K positions. B2 = B1(K+1:end,:) would drop the first K columns of B1, moving it left by K positions. B3 = vertcat(A, zeros(size(a,1),J)) would have "A" as its top, moved up by J positions. B4 = B3(:1:end-J) would drop the bottom J columns of B3, moving it down by J positions.
|
Pages: 1 Prev: Colorbar not drawing correctly Next: find roots on uqtaion |