Back to the main page.

Bug 521 - channel selection in ft_multiplotTFR

Status CLOSED FIXED
Reported 2011-03-04 14:54:00 +0100
Modified 2011-03-09 15:35:03 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P1 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

- 2011-03-04 14:54:30 +0100

Hi, I tried to use the cfg.channel option of ft_multiplotTFR. I selected all channels but one, and then Matlab returns the error : ???Index exceeds matrix dimensions. I've looked at the code, and I think the error comes from the use of seldat indexes for the dat matrix (line 387). Indeed, the dat matrix is previously defined as the data.powspctrm resticted to the selected channels. But at line 387, datavector=dat(seldat,:,:) and seldat are the indexes of the kept channels, but in data.label, where the appropriate channels are not selected, so the indexes can indeed exceed matrix dimensions. I've just replaced datavector=dat(seldat,:,:) by datavector=dat(:,:,:) and it seems to work when using the cfg.channel option or the interactive option. But the datavector variable is then not needed. I think there is the same problem with the maskvector (line 389), but I haven't used this option. I hope I explained my problem clearly. Thank you, Best, Imen EL Karoui


Jan-Mathijs Schoffelen - 2011-03-04 16:17:45 +0100

Dear Imen, Thanks for reporting this. I just committed quite an extensive update to the high-level plotting functions (=yesterday), and I am wondering whether you are using this version, or a slightly older one. Could you check this, and if you indeed are not using an up-to-date version, update to the most recent version, and try to reproduce your problem? My version of ft_multiplotTFR contains an 'end' on line 387 Best wishes, Jan-mathijs


- 2011-03-04 16:59:59 +0100

Dear Jan-Mathijs, Indeed I'm not using the last version, but the 26/02/11 one. With the dat(end,:,:), it will work. Is there a way to update automatically my version of Fieldtrip ? Thank you very much for your help, Best, Imen


- 2011-03-07 09:22:18 +0100

Dear Jan-Mathijs, I downloaded the last version of Fieldtrip and I still have the same problem. It is now at line 396 : datavector is defined as dat(seldat,:,:). If I understood the code correctly, seldat are the indexes of selected channels in the initial data structure but in dat, only data for the selected channels are stored. So the dimensions of dat and data.(cfg.param) are not the same, and this is why I have the error ??? Index exceeds matrix dimensions refering to this line. I solved this problem by defining datavector=dat(:,:,:) (but then I could just use dat). I hope my problem is a bit clearer now. Thanks for your help, Best, Imen El Karoui


Jan-Mathijs Schoffelen - 2011-03-07 09:49:39 +0100

Dear Imen, Thanks for your feedback and sorry for the persistent bug. Also thanks for already searching for the cause of the error. I now fixed it (in line 391 where the lay.label should be compared against label, rather than against data.label). In tonight's ftp-server the problem should be fixed. Best wishes, Jan-Mathijs


Jan-Mathijs Schoffelen - 2011-03-07 09:50:07 +0100

PS: Could you let us know whether it works for you in the newest version? Thanks.


- 2011-03-07 09:55:59 +0100

Dear Jan-Mathijs, Thank you for fixing this so quickly. Using label will also fix the exact same problem with the maskvector, so it's better than what I suggested. I'll check tomorrow with the new version anyway and I'll let you know whether it works. Best, Imen