Skip to content

Commit

Permalink
warn only once when brainvision timestamps cannot be parsed (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbeliy committed Jan 21, 2021
1 parent a0cea15 commit 900cf78
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fileio/private/read_brainvision_vmrk.m
Expand Up @@ -35,6 +35,8 @@
event = [];
line = [];

readTime = ft_platform_supports('datetime');

while ischar(line) || isempty(line)
line = fgetl(fid);
if ~isempty(line) && ~(isnumeric(line) && line==-1)
Expand All @@ -57,11 +59,12 @@
event(end ).value = tok{2};
event(end ).sample = str2double(tok{3});
event(end ).duration = str2double(tok{4});
if numel(tok)>5 && ft_platform_supports('datetime')
if numel(tok)>5 && readTime
try
event(end).timestamp = datetime(tok{6}, 'InputFormat', 'yyyyMMddHHmmssSSSSSS');
catch
ft_warning('skipping invalid datetime in BrainVision marker file');
readTime = false;
end
end
end
Expand Down

0 comments on commit 900cf78

Please sign in to comment.