From: Aishwarya on 20 Jul 2010 18:48 Hello All, I want to shift a (120,120) matrix spatially.I used the following program and got the final image shited along x, as in I am able to shift the data right and left.i am having trouble with shifting the data up and down. clear all; fid = fopen('Homo_noabs_S4D4.bin','r+'); A = fread(fid,'double'); a=reshape(A,120,120,120); a=a(:,:,15); figure,imagesc(a); Y=a; a=reshape(a,14400,1); b=zeros(size(a)); for j=1:size(a(:))-3000 b(j)=a(j+3000); end size(b); b=reshape(b,120,120); figure,imagesc(b);
From: Walter Roberson on 20 Jul 2010 19:00 Aishwarya wrote: > I want to shift a (120,120) matrix spatially.I used the following > program and got the final image shited along x, as in I am able to shift > the data right and left.i am having trouble with shifting the data up > and down. > > > clear all; > fid = fopen('Homo_noabs_S4D4.bin','r+'); > A = fread(fid,'double'); > a=reshape(A,120,120,120); > a=a(:,:,15); > figure,imagesc(a); > Y=a; > a=reshape(a,14400,1); > b=zeros(size(a)); > for j=1:size(a(:))-3000 > b(j)=a(j+3000); > end > size(b); > b=reshape(b,120,120); > figure,imagesc(b); Have you considered using the optional arguments to imagesc() to specify the positions of the corners of the images? imagesc([1000 3000], [2000 4000], a) would put the lower left corner at axes coordinates [1000, 2000] and would put the upper right corner at axes coordinates [3000 4000]. (Not actually the corners themselves, but for the precise details look at the documentation for image() )
From: Sean on 21 Jul 2010 09:59 "Aishwarya " <icemails(a)yahoo.co.in> wrote in message <i25934$7bs$1(a)fred.mathworks.com>... > Hello All, > > I want to shift a (120,120) matrix spatially.I used the following program and got the final image shited along x, as in I am able to shift the data right and left.i am having trouble with shifting the data up and down. > > > clear all; > fid = fopen('Homo_noabs_S4D4.bin','r+'); > A = fread(fid,'double'); > a=reshape(A,120,120,120); > a=a(:,:,15); > figure,imagesc(a); > Y=a; > a=reshape(a,14400,1); > b=zeros(size(a)); > for j=1:size(a(:))-3000 > b(j)=a(j+3000); > end > size(b); > b=reshape(b,120,120); > figure,imagesc(b); If you have the image processing toolbox you could use my tool: http://www.mathworks.com/matlabcentral/fileexchange/27251-imtranslate
|
Pages: 1 Prev: Multivariate minimization with constraints Next: Error when using xlswrite |