function [out]=m2c(in);

%converts a three dimesnional matrix to a single grid

L=length(size(in)); %dimensionality of input

if L>=4 
    error('input matrix has more than 3 (tres) dimensions- the world is only three dimensional')
elseif L<3
    warning('input matrix has fewer than 3 dimensions- this might work but why are you using this script????')
end

[N1, N2, N3]=size(in);

out=zeros(0); %null matrix for future definition
for n=1:N3
    out=[out; (g2c(squeeze(in(:,:,n))))];
end


    
    