%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Transform matrix data in xyz data %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function xyz_data = matrix2XYZ(matrix_data, longitude, latitude)

n1 = size(matrix_data, 1);
n2 = size(matrix_data, 2);

xyz_data = zeros(n1*n2, 3);

counter1 = 1;
for i=1:n1
    
    for j=1:n2
        
        xyz_data(counter1, 1) = longitude(j);
        xyz_data(counter1, 2) = latitude(i);
        xyz_data(counter1, 3) = matrix_data(i, j);
        counter1 = counter1 + 1;
        
    end
    
end
