Skip to content

Commit 55b4e77

Browse files
committed
Copied files over from eeglab plugin download and modified to suit new structure.
1 parent 0238bc4 commit 55b4e77

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Matlab/eeg_load_xdf.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
if args.effective_rate && isfinite(stream.info.effective_srate) && stream.info.effective_srate>0
7070
raw.srate = stream.info.effective_srate;
7171
else
72-
raw.srate = str2num(stream.info.nominal_srate);
72+
raw.srate = str2num(stream.info.nominal_srate); %#ok<ST2NM>
7373
end
7474
raw.xmin = 0;
7575
raw.xmax = (raw.pnts-1)/raw.srate;
@@ -108,19 +108,24 @@
108108

109109
% events...
110110
event = [];
111+
if isfinite(stream.info.effective_srate) && stream.info.effective_srate>0
112+
srate = stream.info.effective_srate;
113+
else
114+
srate = raw.srate;
115+
end
111116
for s=1:length(streams)
112117
if (strcmp(streams{s}.info.type,'Markers') || strcmp(streams{s}.info.type,'Events')) && ~ismember(streams{s}.info.name,args.exclude_markerstreams)
113118
try
114119
if iscell(streams{s}.time_series)
115120
for e=1:length(streams{s}.time_stamps)
116121
event(end+1).type = streams{s}.time_series{e};
117-
event(end).latency = 1+raw.srate*(streams{s}.time_stamps(e)-stream.time_stamps(1));
122+
event(end).latency = 1+srate*(streams{s}.time_stamps(e)-stream.time_stamps(1));
118123
event(end).duration = 1;
119124
end
120125
else
121126
for e=1:length(streams{s}.time_stamps)
122127
event(end+1).type = num2str(streams{s}.time_series(e));
123-
event(end).latency = 1+raw.srate*(streams{s}.time_stamps(e)-stream.time_stamps(1));
128+
event(end).latency = 1+srate*(streams{s}.time_stamps(e)-stream.time_stamps(1));
124129
event(end).duration = 1;
125130
end
126131
end
@@ -131,6 +136,7 @@
131136
end
132137
raw.event = event;
133138

139+
134140
% etc...
135141
raw.etc.desc = stream.info.desc;
136142
raw.etc.info = rmfield(stream.info,'desc');

Matlab/eegplugin_xdfimport.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
function vers = eegplugin_xdfimport(fig, trystrs, catchstrs)
4747

48-
vers = 'xdfimport1.11b';
48+
vers = 'xdfimport1.12';
4949

5050
if nargin < 3
5151
error('eegplugin_xdfimport requires 3 arguments');

Matlab/xdf/load_xdf.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@
145145
% Contains portions of xml2struct Copyright (c) 2010, Wouter Falkena,
146146
% ASTI, TUDelft, 21-08-2010
147147
%
148-
% version 1.11
149-
LIBVERSION = '1.11';
148+
% version 1.12
149+
LIBVERSION = '1.12';
150150

151151
% check inputs
152152
opts = cell2struct(varargin(2:2:end),varargin(1:2:end),2);
@@ -227,6 +227,7 @@
227227
end
228228
end
229229

230+
230231
% ======================
231232
% === parse the file ===
232233
% ======================
@@ -502,7 +503,7 @@
502503
segments(r).t_begin = temp(k).time_stamps(range(1));
503504
segments(r).t_end = temp(k).time_stamps(range(2));
504505
segments(r).duration = segments(r).t_end - segments(r).t_begin;
505-
segments(r).effective_srate = (segments(r).num_samples-1)/ segments(r).duration;
506+
segments(r).effective_srate = segments(r).num_samples / segments(r).duration;
506507
end
507508

508509
% calculate the weighted mean sampling rate over all segments

0 commit comments

Comments
 (0)