function ds = read_syncdata(data_files) % settings %DATASET_DIR = 'test_20221'; TS_FILE_EXT = 'ts'; %SAMPLE_FILE_PREFIX = 'ch_'; SAMPLE_FILE_EXT = 'dat'; %CHANNELS = 2; %for ch=0:1:(CHANNELS-1) % FN_SAMPLE{ch+1} = strcat(data_files, '/', SAMPLE_FILE_PREFIX, num2str(ch), '.', SAMPLE_FILE_EXT); %end [files_n,~] = size(data_files); s = []; ts = []; for i=1:files_n data_file = data_files(i,:); % load timestamps FN_TS = strcat(data_file, '.', TS_FILE_EXT); f = fopen(FN_TS ,'r'); d = fread(f,[2,Inf],'uint32'); fclose(f); % create fractional timestamp d = d(1,:) + d(2,:) / 1E+09; ts = [ts; d]; % get sample count %sample_cnt = length(ts); % load samples FN_SAMPLE = strcat(data_file, '.', SAMPLE_FILE_EXT); f = fopen(FN_SAMPLE,'r'); d = fread(f, [1,Inf],'int16'); s = [s; d]; fclose(f); end %figure(1) %plot(ts(1,1:100), s(1,1:100), 'x') %xlim([ts(1) ts(100)]) %hold on ds = [ts' s']; end