From 3507456719560ea6729d3490d61a56bfb52a9b45 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 11 Jan 2012 13:18:12 -0500 Subject: map2dat.m fix of wrong indexing --- .../fast_to_slow_switch/map2dat.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xmds2/Nlevels_with_doppler_with_z_4wm/fast_to_slow_switch/map2dat.m b/xmds2/Nlevels_with_doppler_with_z_4wm/fast_to_slow_switch/map2dat.m index 969b6dc..4f4ca52 100644 --- a/xmds2/Nlevels_with_doppler_with_z_4wm/fast_to_slow_switch/map2dat.m +++ b/xmds2/Nlevels_with_doppler_with_z_4wm/fast_to_slow_switch/map2dat.m @@ -9,17 +9,17 @@ function map2dat(outfile, x,y,z, xskip, yskip) Nx=length(x); Ny=length(y); -Nxs=Nx/xskip; -Nys=Ny/yskip; +Nxs=ceil(Nx/xskip); +Nys=ceil(Ny/yskip); points=zeros(1,3*Nxs*Nys); %points=[]; tic; for i=1:Nxs for k=1:Nys %points=[points x(i*xskip) y(k*yskip) z(k*yskip,i*xskip)]; - points((i-1)*(Nys-1)*3+3*(k-1)+1) = x(i*xskip); - points((i-1)*(Nys-1)*3+3*(k-1)+2) = y(k*yskip); - points((i-1)*(Nys-1)*3+3*(k-1)+3) = z(k*yskip,i*xskip); + points((i-1)*(Nys)*3+3*(k-1)+1) = x(1+(i-1)*xskip); + points((i-1)*(Nys)*3+3*(k-1)+2) = y(1+(k-1)*yskip); + points((i-1)*(Nys)*3+3*(k-1)+3) = z(1+(k-1)*yskip,1+(i-1)*xskip); end end disp('=== points formation complete ==='); -- cgit v1.2.3