Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX - fix for fastread functionality with nsmp/buffer>1 #31

Merged
merged 1 commit into from
Aug 27, 2024
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 matlab/fiff_read_raw_segment.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@
error(me,'This datafile does not allow for fast reading');
end

first = find(raw.rawdir.first==from);
last = find(raw.rawdir.last==to);
first = find(raw.rawdir.first<=from,1,'last');
last = find(raw.rawdir.last>=to,1,'first');

n = last - first + 1;
n = last - first + 1; % number of buffers to read to capture the requested segment

fseek(fid, raw.rawdir.pos(first), 'bof');
tmp = fread(fid, [nrows*raw.rawdir.nsamp+nextra n], readstr);
Expand All @@ -208,6 +208,9 @@
data = reshape(data, [nrows raw.rawdir.nsamp*n]);
end

% only a subpart of the chunk of data may be requested
data = data(:, (from-raw.rawdir.first(first)+1):(to-raw.rawdir.first(first)+1));

if iscomplex
error(me, 'fast reading complex-valued data is not yet supported');
% FIXME, no reason not to implement this
Expand Down
Loading