Back to the main page.

Bug 1333 - Scaling using cfg.chanscale crashes ft_databrowser if more than one channel selected

Reported 2012-02-16 12:09:00 +0100
Modified 2012-08-23 10:35:12 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: All
Operating System: All
Importance: P3 normal
Assigned to: Eelke Spaak
Depends on:
See also:

Tilmann Sander-Thommes - 2012-02-16 12:09:39 +0100

line 1203 ff in ft_databrowser.m reads ... if ~isempty(cfg.chanscale) chansel = match_str(lab, ft_channelselection(, lab)); dat(chansel,:) = dat(chansel,:) .* repmat(cfg.chanscale,1,size(dat,2)); end ... If cfg.chanscale has more than one entry then code crashes due to matrix dimension mismatch,code works if cfg.chanscale is transposed to read ... dat(chansel,:) = dat(chansel,:) .* repmat(cfg.chanscale',1,size(dat,2)); ... The error was produced by % read complete Yokogawa data file and then = {'AG087'; 'EEG129';}; cfg.chanscale = [1.0e11 1.0]; cfg.viewmode = 'vertical'; inspect = ft_databrowser(cfg, data); Please confirm error and solution and I can fix it if solution approved. Till

Eelke Spaak - 2012-03-14 11:32:57 +0100

Hi Till, Thanks for your report. Actually, the error was in your calling code :) The documentation for ft_databrowser reads: % cfg.chanscale = Nx1 vector with scaling factors, one per channel specified in and you provided a 1xN (=row) vector, rather than a Nx1 (=column) vector. Your proposed 'fix' only changes the problem so that now people entering a column vector will get the error (so the documentation would then have to be changed to read 1xN). However, you do raise a point that it would be convenient to be able to enter in a vector of arbitrary row/column shape. So, I will implement a check that converts a row to column vector, if necessary. Best, Eelke

Eelke Spaak - 2012-03-14 11:36:02 +0100

bash-3.2$ svn commit ft_databrowser.m Sending ft_databrowser.m Transmitting file data . Committed revision 5460.

Eelke Spaak - 2012-08-23 10:35:12 +0200

closing my bugs