[FieldTrip] how to make the cfg.selectfeature work in ft_databrowser?

Thomas Kustermann tfkustermann at gmail.com
Fri Apr 7 17:45:09 CEST 2017


Hello Diego,

taking a look at the underlying code it seems that while multiple input
arguments to cfg.selectfeature are accepted and passed on to
artfctdef.xxx.artifact (line 403), the function then attempts to select the
current artifact from cfg.selectfeature even when multiple arguments are
entered.
opt.ftsel       = find(strcmp(artlabel,cfg.selectfeature)); % current
artifact/feature being selected (line 629)

You could either change this line to:
opt.ftsel       = find(strcmp(artlabel,cfg.selectfeature{1})); % current
artifact/feature being selected

automatically selecting the first input argument to cfg.selectfeature as
default selection in ft_databrowser or you could write them to the
cfg.artfctdef.xxx.artifact
manually:

cfg.selectfeature = 'a';
cfg.artfctdef.a.artifact = zeros(0,2);
cfg.artfctdef.b.artifact = zeros(0,2);
...

Best,
Thomas



On Fri, Mar 31, 2017 at 4:40 PM, Diego Lozano-Soldevilla <
dlozanosoldevilla at gmail.com> wrote:

> Hi all,
>
> I'm using ft_databrowser to inspect sleep data and I want to visually mark
> different events (spindles, k-complexes, artifacts, so forth) and asign
> them to different cfg.artfctdef.xxx.artifact substructures. Could somebody
> help me to mark different artifact trial types using the cfg.selectfeature
> option? Please find below the code and data to reproduce the error I got.
> I'm using the very last fieldtrip version on windows with matlab 7.9b.
>
> Thanks beforehand,
>
> Diego
>
>
>
> data = [];
> data.label = {'Fpz';'F7';'F3';'Fz';'F4';'F8';'C3';'Cz';'C4';'P3';'Pz';'
> P4';'O1';'Oz';'O2'};
> data.fsample = 250;
> data.trial{1} = rand(size(data.label,1),data.fsample*30);
> data.time{1} = (1:data.fsample*30)./data.fsample;
>
> cfg         = [];
> cfg.length  = 2;
> cfg.overlap = 0;
> trl = ft_redefinetrial(cfg,data);
>
>
> cfg           = [];
> cfg.channel   = 'all';
> cfg.blocksize = 2;
> cfg.selectfeature = {'a';'b'};
> cfg.viewmode  = 'vertical';
> events = ft_databrowser(cfg,trl);
>
>
> the input is raw data with 15 channels and 15 trials
> detected   0 a artifacts
> detected   0 b artifacts
> ??? Error using ==> plus
> Matrix dimensions must agree.
>
> Error in ==> ft_databrowser at 745
>   hsel = [1 2 3] + (opt.ftsel-1) .*3;
>
> ??? Reference to non-existent field 'trlvis'.
>
> Error in ==> ft_databrowser>redraw_cb at 1639
> begsample = opt.trlvis(opt.trlop, 1);
>
> Error in ==> ft_databrowser>winresize_cb at 2250
> redraw_cb(h,eventdata);
>
> ??? Error while evaluating figure ResizeFcn
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-281810346689554922_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170407/4d50d5b7/attachment-0001.html>


More information about the fieldtrip mailing list