function [X,Y,Z,C]=open_single_dat_file_3d()

Nx=201;
Ny=201;
Nz=101;

n_lines=Nx*Ny*Nz;

filename='poisson.dat';
fid=fopen(filename);

X=0*(1:n_lines);
Y=0*(1:n_lines);
Z=0*(1:n_lines);
C=0*(1:n_lines);

for i=1:n_lines
    c1=fgetl(fid);
    vec_temp=sscanf(c1,'%f');
    x_temp=vec_temp(1);
    y_temp=vec_temp(2);
    z_temp=vec_temp(3);
    
    X(i)=x_temp;
    Y(i)=y_temp;
    Z(i)=z_temp;
    
    c1=fgetl(fid);
    vec_temp=sscanf(c1,'%f');
    c_temp=vec_temp(1);
    
    C(i)=c_temp;
    
    if(mod(i,100000)==0)
        frac=100*(i/n_lines);
        display(strcat(num2str(frac),'% done'))
    end
    
end

X=reshape(X,Nx,Ny,Nz);
Y=reshape(Y,Nx,Ny,Nz);
Z=reshape(Z,Nx,Ny,Nz);
C=reshape(C,Nx,Ny,Nz);

fclose(fid);
    
end