function [res] = importone( input_matrix )
% Convert input to the usual dataset format
%   input_matrix: imported matrix, in ONE report format

s = size(input_matrix);

nrows = s(1);

m = uint8(min(input_matrix))

if(min(m(2) == 0 ) || min(m(3)) == 0 )
    for ii = 1:nrows
        input_matrix(ii,2) =  input_matrix(ii,2) + 1;
        input_matrix(ii,3) =  input_matrix(ii,3) + 1;
    end
end
 
jj = 1;


totalnodes = uint8(max(input_matrix))
totalnodes = max(totalnodes(1),totalnodes(2))

start_times = zeros(totalnodes);

res = zeros(floor(nrows/2), 4);

for ii = 1:nrows
    if (input_matrix(ii,4) == 0)
        start_times(input_matrix(ii,2),input_matrix(ii,3)) = round(input_matrix(ii,1));
    else
        res(jj,1) = input_matrix(ii,2);
        res(jj,2) = input_matrix(ii,3);
        res(jj,3) = start_times(input_matrix(ii,2),input_matrix(ii,3));
        res(jj,4) = round(input_matrix(ii,1));
        jj = jj + 1;
    end
end

return;
end
