
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Reads the .picotd file
%Input:
%   -file_name:the .picotd file name that is obtained using Picometrix system
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [t,x] = readPicotd(filename)
fid = fopen(filename);


%The first 4 lines are header
%escape the first 4 lines and read the file from the 5th line
for ind=1:5
    fgetl(fid);
end


time = zeros(4096,1);% Read time values
Amp = zeros(4096,1);% Read amplitude values
for ind = 1:4096
    tmp = fgetl(fid);
    time(ind) = str2double(tmp(1:7));
    Amp(ind) = str2double(tmp(8:end));
end

t = time.';
x = Amp.';

% Close file
fclose(fid);

end









