From 4aaa16142eb37b130f663c39e437f573c5cc1ec2 Mon Sep 17 00:00:00 2001 From: LucaPT Date: Fri, 25 Jan 2019 13:45:25 -0800 Subject: [PATCH] fixed error when EEG.icaact has type single and added relevant test --- ICL_feature_extractor.m | 3 ++- run_tests.m | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ICL_feature_extractor.m b/ICL_feature_extractor.m index 8376d45..95ac779 100644 --- a/ICL_feature_extractor.m +++ b/ICL_feature_extractor.m @@ -11,10 +11,11 @@ % check for ica assert(isfield(EEG, 'icawinv'), 'You must have an ICA decomposition to use ICLabel') -% calculate ica activations if missing +% calculate ica activations if missing and cast to double if isempty(EEG.icaact) EEG.icaact = eeg_getica(EEG); end +EEG.icaact = double(EEG.icaact); % check ica is real assert(isreal(EEG.icaact), 'Your ICA decomposition must be real to use ICLabel') diff --git a/run_tests.m b/run_tests.m index 1f4ea9c..5750c53 100644 --- a/run_tests.m +++ b/run_tests.m @@ -35,9 +35,11 @@ function run_tests() EEG = pop_epoch(EEG, {'square'}, [-1 1]); end - %% test complete ICA + %% test complete ICA with data as singles EEG_temp = setup(EEG, icasphere, icaweights, 1:32); + EEG_temp.data = single(EEG_temp.data); + EEG_temp.icaact = single(EEG_temp.icaact); test_iclabel(EEG_temp)