[FieldTrip] ft_preprocessing for mat file

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Tue May 14 08:14:59 CEST 2024


Hi Sina,

the ‘.mat’ file format is used by matlab to store arbitrary variables that can be loaded into matlab with the ‘load’ function, indeed as you mentioned. However, this does not mean that any variable that you load into matlab can be processed by fieldtrip functions, or that by arbitrarily storing those variables into a fieldtrip cfg-structure will work. FieldTrip ‘expects’ data to be organized in constrained, and well-defined structures (i.e. variables with fields that contain (meta)data), it does not work out of the box on arbitrary data.

I strongly suggest you to start at the beginning, and study the fieldtrip documentation in detail about how to get started, how data structures are defined, etc. (specifically I would throw in a google search for ‘how are fieldtrip data structures defined’), and extensively explore the ‘getting started’ section on the fieldtrip website, whichis located at fieldtriptoolbox.org<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffieldtriptoolbox.org%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Ca33e3070ce6a43c52a7908dc73dd2f15%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638512641007391884%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=b6kWbl9Z3jCKF%2BDVrU7zPxCL19DEcxJmiGXjvu7%2FPXY%3D&reserved=0>

Good luck with your endeavours,

Jan-Mathijs



On 8 May 2024, at 23:53, Sina Makhdoomi Kaviri via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

To whom it may concern,

I want to preprocess .mat file which can be found in ( http://bnci-horizon-2020.eu/database/data-sets<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbnci-horizon-2020.eu%2Fdatabase%2Fdata-sets&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Ca33e3070ce6a43c52a7908dc73dd2f15%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638512641007548156%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=frNqh15yYtxTezH3EWvSETr1v3lMb2GsWG7DMryRso0%3D&reserved=0> (Accession Number 001-2020)). I can access to the files by regular load function in Matlab, but it has an error as follows in ft_preprocessing:

>> %% Data preprocessing
dataset = 'D:/fieldtrip/dataset/RGdataset/G01.mat';
dataset1 = load(dataset);
data = dataset1.signal;
header  = dataset1.header
channel = header.channels_labels;
cfg = [];
cfg.dataset              = dataset;
cfg.continuous           = 'yes';
cfg.datafile             = data;
cfg.headerfile           = header;
cfg.channel              = channel;
data_segmented           = ft_preprocessing(cfg);

header =
  struct with fields:
               runs: []
        device_type: 'gtec'
       channels_eeg: [1×58 double]
       channels_eog: [59 60 61 62 63 64]
    channels_labels: {1×64 cell}
        sample_rate: 256
        event_codes: [503587 501794 534562 503588 501795 534563 768 769 10 11 12 13 14 15]
        event_names: {1×14 cell}

Dot indexing is not supported for variables of this type.

Error in ft_read_header (line 2795)
if numel(hdr.label) < hdr.nChans

Error in ft_preprocessing (line 391)
  hdr = ft_read_header(cfg.headerfile, headeropt{:});

Please let me know how I can preprocess this dataset to source localization or reconstruction methods.

Best regards,
Sina
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Ca33e3070ce6a43c52a7908dc73dd2f15%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638512641007548156%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=UZFy4hCGkxlE1FvyVBhkLeSuroItaMzAtbp4q9UpCck%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240514/cf6bc17c/attachment.htm>


More information about the fieldtrip mailing list