Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions functions/adminfunc/eeg_getdatact.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,24 +238,27 @@
% reading data file
% -----------------
eeglab_options;
% read directly in single precision when requested; reading as double first
% needs twice the memory and is much slower for large files
if option_single, precision = 'float32=>single'; else, precision = 'float32'; end
if length(opt.channel) == EEG.nbchan && option_memmapdata
fclose(fid);
data = mmo(filename, [EEG.nbchan EEG.pnts EEG.trials], false);
%data = memmapdata(filename, [EEG.nbchan EEG.pnts EEG.trials]);
else
if datformat
if length(opt.channel) == EEG.nbchan || ~isempty(opt.interp)
data = fread(fid, [EEG.trials*EEG.pnts EEG.nbchan], 'float32')';
data = fread(fid, [EEG.trials*EEG.pnts EEG.nbchan], precision)';
else
data = repmat(single(0), [ length(opt.channel) EEG.pnts EEG.trials ]);
for ind = 1:length(opt.channel)
fseek(fid, (opt.channel(ind)-1)*EEG.pnts*EEG.trials*4, -1);
data(ind,:) = fread(fid, [EEG.trials*EEG.pnts 1], 'float32')';
data(ind,:) = fread(fid, [EEG.trials*EEG.pnts 1], precision)';
end
opt.channel = [1:size(data,1)];
end
else
data = fread(fid, [EEG.nbchan Inf], 'float32');
data = fread(fid, [EEG.nbchan Inf], precision);
end
fclose(fid);
end
Expand Down
Loading