summaryrefslogtreecommitdiff
path: root/xmds2/Nlevels_no_dopler_with_z_4wm/map2dat.m
blob: 969b6dc1a713220dd5a09f22e10d75c15d00115b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function map2dat(outfile, x,y,z, xskip, yskip)
% saves 3D data in suitable way to be drawn by gnuplot
% x,y - vectors of x,y values
% z map of z values as used by Octave/Matlab
% xskip, yskip - skip paprameters
%  only every, xskip, yskip point will be written



Nx=length(x);   
Ny=length(y);   
Nxs=Nx/xskip;
Nys=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);
	end
end
disp('=== points formation complete ===');
toc
tic;
%points
fd = fopen(outfile, "wt");
fprintf (fd, "%g %g %g\n", points);
fclose(fd);
disp('=== points saving complete ===');
toc;