diff --git a/preProcess/preprocessDataSub.m b/preProcess/preprocessDataSub.m index 1add3c38..1f8f7ca1 100644 --- a/preProcess/preprocessDataSub.m +++ b/preProcess/preprocessDataSub.m @@ -74,7 +74,13 @@ fprintf('Time %3.0fs. Loading raw data and applying filters... \n', toc); fid = fopen(ops.fbinary, 'r'); % open for reading raw data +if fid<3 + error('Could not open %s for reading.',ops.fbinary); +end fidW = fopen(ops.fproc, 'w'); % open for writing processed data +if fidW<3 + error('Could not open %s for writing.',ops.fproc); +end for ibatch = 1:Nbatch % we'll create a binary file of batches of NT samples, which overlap consecutively on ops.ntbuff samples @@ -103,7 +109,10 @@ datr = datr * Wrot; % whiten the data and scale by 200 for int16 range datcpu = gather(int16(datr)); % convert to int16, and gather on the CPU side - fwrite(fidW, datcpu, 'int16'); % write this batch to binary file + count = fwrite(fidW, datcpu, 'int16'); % write this batch to binary file + if count~=numel(datcpu) + error('Error writing batch %g to %s. Check available disk space.',ibatch,ops.fproc); + end end rez.Wrot = gather(Wrot); % gather the whitening matrix as a CPU variable