From 0a034fdb40d61f0c61f9eb93aeb92fccd2524c21 Mon Sep 17 00:00:00 2001 From: jscastanoc Date: Mon, 9 Mar 2015 18:04:43 +0100 Subject: [PATCH] Fix loading data with channels having different units --- fileio/file_readBV.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fileio/file_readBV.m b/fileio/file_readBV.m index c34c586..4a59013 100644 --- a/fileio/file_readBV.m +++ b/fileio/file_readBV.m @@ -371,7 +371,17 @@ % read the data, read_bv will set the data in cnt.x because of the % read_opt.data options read_bv([fileNames{filePos} '.eeg'], read_hdr, read_opt); - cnt.yUnit= hdr{filePos}.unit; + if isfield(hdr{filePos},'unit') + cnt.yUnit= hdr{filePos}.unit; + end + if isfield(hdr{filePos},'unitOfClab') + cnt.yUnit= hdr{filePos}.unitOfClab; + end + + if ~isfield(cnt, 'yUnit') + ME = MException('InvalidUnits','Could not read units of the channels from the header file'); + throw(ME); + end %% Markers if nargout>1,