csn-le / wave_clus

A fast and unsupervised algorithm for spike detection and sorting using wavelets and super-paramagnetic clustering
127 stars 66 forks source link

Wavelet Toolbox. Error using prod Invalid data type. First argument must be numeric or logical. #182

Open Ben-Girard opened 4 years ago

Ben-Girard commented 4 years ago

Hello,

I am using Matlab 2020 on Windoys 10. I got an issue probably coming from the Wavelets Toolbox. When loading .ncs Neuralynx files, I have this error :

Error using prod
Invalid data type. First argument must be numeric or logical.
Error in wmemutil (line 42)
                l       = 3+prod(s);
Error in wavemngr (line 426)
        tab_file      = wmemutil('get',Wavelets_Info,ind_tab_file);
Error in wfilters (line 40)
[wtype,fname] = wavemngr('info',wname);
Error in wavedec (line 36)
        [LoF_D,HiF_D] = wfilters(arg3,'d');
Error in wave_features (line 37)
                    [c,l] = wavedec(spikes(i,:),scales,'haar');
Error in wave_clus>load_data_button_Callback (line 234)
    [inspk] = wave_features(spikes,handles.par);                 %Extract spike features.
Error in gui_mainfcn (line 95)
        feval(varargin{:});
Error in wave_clus (line 63)
    gui_mainfcn(gui_State, varargin{:});
Error while evaluating UIControl Callback.

This is solved when not using the Wavelet Toolbox in the wave_features.m :

%           if exist('wavedec')                             % Looks for Wavelets Toolbox
%               for i=1:nspk                                % Wavelet decomposition
%                   [c,l] = wavedec(spikes(i,:),scales,'haar');
%                   cc(i,1:ls) = c(1:ls);
%               end
%           else
                for i=1:nspk                                % Replaces Wavelets Toolbox, if not available
                    [c,l] = fix_wavedec(spikes(i,:),scales);
                    cc(i,1:ls) = c(1:ls);
                end
%           end

Even if it is now working, maybe it could help someone. If you have any suggestion I would be interested.

Sincerely,

Benoit Girard