Back to the main page.

Bug 1869 - forward/ft_senstype.m calls non existing sens variable

Status CLOSED FIXED
Reported 2012-12-04 16:48:00 +0100
Modified 2018-03-10 21:58:08 +0100
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P3 normal
Assigned to: Lilla Magyari
URL:
Tags:
Depends on:
Blocks:
See also:

Lilla Magyari - 2012-12-04 16:48:36 +0100

Hi, I tried to run ft_sourcenanalyisis on my eeg freq analysis data, but I run into this error. the input is freq data with 59 channels, 1 frequencybins and no timebins using headmodel specified in the configuration ??? Undefined function or variable "sens". Error in ==> ft_senstype at 200 if isfield(sens, 'type') Error in ==> ft_fetch_sens at 54 iseeg = ft_senstype(data, 'eeg'); Error in ==> prepare_headmodel at 54 sens = ft_fetch_sens(cfg, data); Error in ==> ft_sourceanalysis at 325 [vol, sens, cfg] = prepare_headmodel(cfg, data); The problem was (I think) that there was a structure called sens which in some cases did not exist yet, while it has been already called in ft_senstype.m. I made the following correction: bash-3.2$ svn diff ft_senstype.m Index: ft_senstype.m =================================================================== --- ft_senstype.m (revision 7071) +++ ft_senstype.m (working copy) @@ -196,7 +196,17 @@ sens = []; end -if isfield(sens, 'type') +if exist('sens') + if isfield(sens,'type') + istypefield = 1; + else + istypefield = 0; + end +else + istypefield = 0; +end + +if istypefield % preferably the structure specifies its own type type = sens.type; elseif isfield(input, 'nChans') && input.nChans==1 && isfield(input, 'label') && ~isempty(regexp(input.label{1}, '^csc', 'once')) bash-3.2$ cd .. But probably it is a better solution, if the "if..." in line 150 would assign seg=[] in all cases. The test_ft_senstype.m has run fine after the change, but I did not commit the changes yet. First of all, my question is: there are also ft_senstype functions in other directories. Should be those changed too? Lilla


Eelke Spaak - 2012-12-04 19:18:18 +0100

The fix looks fine to me. If you update one instance of ft_senstype.m, all the others will automatically be updated (through the autosync mechanism). If you call svn update after your commit, all the other instances will be updated.


Lilla Magyari - 2012-12-05 12:23:49 +0100

(In reply to comment #1) thanks. revision 7094


Lilla Magyari - 2012-12-05 12:24:43 +0100

see earlier comment.