Skip to content

Commit

Permalink
fixed format for binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
lolaBerkowitz committed Dec 3, 2024
1 parent b9fd027 commit 521bbc2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions preprocessing/binary/trim_dat_all.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


%% User defines intervals of time to remove (in samples interval_i by [start, end] )
bad_intervals = ...
bad_intervals = [],...
[11612.2, 11890.2];

basepath = pwd;
Expand Down Expand Up @@ -53,25 +53,26 @@
% write auxiliary file
d = dir('auxiliary_original.dat');
nChannels = double(int64(d.bytes/2/nSamp));
data = memmapfile('auxiliary_original.dat', 'Format', {'int16', [nChannels, nSamp], 'x'});
data = memmapfile('auxiliary_original.dat', 'Format', {'uint16', [nChannels, nSamp], 'x'});
f = fopen('auxiliary.dat', 'w');
fwrite(f, data.Data.x(:, idx), 'int16');
fwrite(f, data.Data.x(:, idx), 'uint16');
fclose(f);

% write digitalin file
d = dir('digitalin_original.dat');
nChannels = double(int64(d.bytes/2/nSamp));
data = memmapfile('digitalin_original.dat', 'Format', {'int16', [nChannels, nSamp], 'x'});
data = memmapfile('digitalin_original.dat', 'Format', {'uint16', [nChannels, nSamp], 'x'});
f = fopen('digitalin.dat', 'w');
fwrite(f, data.Data.x(:, idx), 'int16');
fwrite(f, data.Data.x(:, idx), 'uint16');
fclose(f);

% write time file
error('This part of the script does not reset time')
d = dir('time_original.dat');
nChannels = double(int64(d.bytes/2/nSamp));
data = memmapfile('time_original.dat', 'Format', {'int16', [nChannels, nSamp], 'x'});
data = memmapfile('time_original.dat', 'Format', {'int32', [nChannels, nSamp], 'x'});
f = fopen('time.dat', 'w');
fwrite(f, data.Data.x(:, idx), 'int16');
fwrite(f, data.Data.x(:, idx), 'int32');
fclose(f);

%%%%%% Local function below
Expand Down

0 comments on commit 521bbc2

Please sign in to comment.