1function [d, t] = readDetection(file, fs, chunkSize)
2%[d, t] = readDetection(file, fs, chunkSize)
3%
4%Reads a detection signal from a DAT file.
5%
6%d: The detection signal.
7%t: The respective time vector.
8%
9%file: The DAT file where the detection signal is stored in float format.
10%fs: The signal sample rate in Hertz.
11%chunkSize: The chunk size used for the detection in seconds.
12fid = fopen(file);
13d = fread(fid, inf, 'float');
14fclose(fid);
15t = 0:(1 / fs):(length(d) * chunkSize - 1 / fs);
16d = d(floor(t / chunkSize) + 1);
17