From 3d8b84d8cbdd55d8ecc1fb217e389c42f06fe7a5 Mon Sep 17 00:00:00 2001 From: Samuel Powell Date: Fri, 18 Nov 2022 08:55:24 +0000 Subject: [PATCH] Filter non printable event markers (#43) * Pre-filter events from LUFR files to exclude ASCII < 32 --- +lumofile/read_lufr.m | 17 +++++++++++++++++ +lumomat/ver.m | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/+lumofile/read_lufr.m b/+lumofile/read_lufr.m index 21c725b..213ba3e 100644 --- a/+lumofile/read_lufr.m +++ b/+lumofile/read_lufr.m @@ -860,6 +860,23 @@ events = []; end +% Filter events (remove non printable characters) +evfilt = true(ne,1); +for i = 1:ne + if(length(events(i).mark) == 1) + if events(i).mark < char(32) + evfilt(i) = false; + end + end +end + +events = events(evfilt); + +if(sum(~evfilt) > 0) + fprintf('Filtering %d/%d invalid event markers from recording\n', sum(~evfilt), length(evfilt)); +end + + % Build data output structure data = struct('chn_dat', chdat, ... 'chn_dt', tchdat*1e3, ... diff --git a/+lumomat/ver.m b/+lumomat/ver.m index ebef683..31133f3 100644 --- a/+lumomat/ver.m +++ b/+lumomat/ver.m @@ -1,5 +1,5 @@ function [ver] = ver() %LMVER Return the hard coded version of the package -ver = '1.6.0-dev'; +ver = '1.5.1'; end