Back to the main page.
Bug 1333 - Scaling using cfg.chanscale crashes ft_databrowser if more than one channel selected
Status | CLOSED FIXED |
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 |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
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(cfg.channel, 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 cfg.channel = {'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 cfg.channel 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.