methlabUZH / automagic

Automagic
GNU General Public License v3.0
89 stars 32 forks source link

Reading sampling rate when definind Project - possible bug? #63

Closed ramBrain closed 2 years ago

ramBrain commented 2 years ago

Dear Dawid,

If I do not enter the sampling rate when defining the Project right before running the preprocessing, it will error. According to the documentation, it should pick up the sampling rate from EEG.sref, which seems to be what it tries to do, but there might be a bug when testing whether the sampling rate is included as an input parameter. Specifically, from line 265 of ./src/Project.m:

if ~ isempty(varargin{:})
        self.sRate = varargin{1};
else
        if(any(strcmp(self.fileExtension, {self.CGV.EXTENSIONS.text})))
                  error('You need to provide sampling rate for the .txt extension.');
        end
end

I think that line 265 should be if ~ isempty(varargin), without curly brackets, otherwise it will try to list elements of an empty cell array, and will error.

Please let me know if I am missing anything here.

Thanks, Ramtin

ksgfan commented 2 years ago

Dear Ramtin,

You're correct. Thanks!

Best, Dawid