pbos@webrtc.org | 788acd1 | 2014-12-15 09:41:24 +0000 | [diff] [blame^] | 1 | function [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. |
| 12 | fid = fopen(file); |
| 13 | d = fread(fid, inf, 'float'); |
| 14 | fclose(fid); |
| 15 | t = 0:(1 / fs):(length(d) * chunkSize - 1 / fs); |
| 16 | d = d(floor(t / chunkSize) + 1); |