[FieldTrip] plotting events from ft_read_event in ft_databrowser

Roy Cox roycox.roycox at gmail.com
Wed Mar 26 17:10:29 CET 2025


hi Jan-Mathijs,

That's it, all sorted now!

Roy

On Tue, Mar 25, 2025 at 6:59 PM Schoffelen, J.M. (Jan Mathijs) via
fieldtrip <fieldtrip at science.ru.nl> wrote:

> Hi Roy,
>
> A warning is not an error, so that in itself shouldn’t be the issue.
>
> What is the issue, though, is that one of the following will work:
>
> put your my_events in the cfg, rather than the data, i.e. cfg.event =
> my_events, and supply this cfg to ft_databrowser(cfg,data);
>
> put your my_events in data.cfg, rather than in data, i.e. data.cfg.event =
> my_events
>
> Best wishes,
> Jan-Mathijs
>
> On 21 Mar 2025, at 12:44, Roy Cox via fieldtrip <fieldtrip at science.ru.nl>
> wrote:
>
> hi all,
>
> Likely I'm missing something obvious, but I'm trying to figure out how to
> pass an event structure read in by ft_read_event on to ft_databrowser in
> order to visualize events.
>
> Reading in a Brainvision file using ft_preprocessing, followed by
> explicitly reading in the events and adding them to the dataset, like so:
>
> *%read continuous (single-trial) data*
>
>
>
> *cfg=[]; cfg.dataset='some_path'; cfg.readbids = 'no';
> data=ft_preprocessing(cfg);*
>
>
>
>
> * %read the events
> my_events=ft_read_event(cfg.dataset,'eventformat','brainvision_vhdr','readbids','no');
> *
> *%add to data*
> *data.event=my_events;*
>
> * %looks ok:*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *struct2table(data.event) ans =   6×5 table          type
>           value                       sample      duration       offset
>   _______________    _______________________________________    __________
>    ________    ____________     {'Time 0'     }    {0×0 double
>               }             1         0      {0×0 double}     {'Stimulus'
> }    {'recordingtime: 10-Mar-2025 22:49:30'}             1         0
>  {0×0 double}     {'Time 0'     }    {0×0 double
> }             1         0      {0×0 double}     {'New Segment'}    {0×0
> double                           }             1         0      {0×0
> double}     {'Stimulus'   }    {'sync_Amp time'                      }
>       265     5e+05      {0×0 double}     {'Stimulus'   }    {'LOFF_Lights
> off'                    }    2.1014e+05     5e+05      {0×0 double}*
>
> *ans = *
>
> When I call ft_databrowser on this data strcuture, I get multiple
> instances of the following warning and no event markers are plotted:
>
>
>
>
>
>
>
>
>
>
> *Warning: could not determine dimord of "event" in:            hdr: [1×1
> struct]          label: {264×1 cell}           time: {[0 0.0040 0.0080
> 0.0120 0.0160 0.0200 0.0240 0.0280 0.0320 0.0360 0.0400 0.0440 0.0480
> 0.0520 0.0560 0.0600 0.0640 0.0680 0.0720 … ]}          trial:
> {[264×1571182 double]}        fsample: 250     sampleinfo: [1 1571182]
>        cfg: [1×1 struct]          event: [1×6 struct]*
>
> Dove in a bit, and it looks like *getdimord *is called on *data.event*,
> which is probably not what should happen.
>
> Any suggestions? Thanks!
>
> Roy
> _______________________________________________
> fieldtrip mailing list
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2efeb27eb00540133ea108dd6c80c510%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638786022502547516%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=q9o2YWFKwM5RFH6rLNARulDkb7JVC32oIIwS2WjUqjY%3D&reserved=0
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2efeb27eb00540133ea108dd6c80c510%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638786022502563744%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=3XJdF5EvHz40J7zWVYTFUc1dHIiIRm1JZlTkTRfHLXg%3D&reserved=0
>
>
> _______________________________________________
> fieldtrip mailing list
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2efeb27eb00540133ea108dd6c80c510%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638786022502575950%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=6xDmgMq%2BfH5V5HI6dK2WfBWoRZBib78Mq073qPrFTCw%3D&reserved=0
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2efeb27eb00540133ea108dd6c80c510%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638786022502597363%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=1zLPzlREs5V%2F2RmnXiox66ED3mz2UdRp7e6%2B0DzFpV4%3D&reserved=0
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250326/d2b9e462/attachment.htm>


More information about the fieldtrip mailing list