[FieldTrip] HELP: import simple data from txt file - non supported format, no header

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Thu Nov 29 19:37:11 CET 2018


Hi Tony,

As long as you are able to load the data into MATLAB, you should be able to
put it into a MATLAB structure that is in accordance with how FieldTrip
expect data to be organized. See the second paragraph "Circumvent the
FieldTrip reading functions" of the FAQ
<http://www.fieldtriptoolbox.org/faq/how_can_i_import_my_own_dataformat?s[]=dataformat>you
referred to, and this FAQ
<http://www.fieldtriptoolbox.org/faq/how_are_the_various_data_structures_defined>on
the data structures.

It will be something like (syntax is probably wrong):

% read from file
mydatafromfile = tdfread('mydata.txt'); % check the help of the read
function, not sure how this goes exactly

% datastructure of raw data, i.e. not epoched
mydata = [];
mydata.label = {'env1','env2','env3','eeg1','eeg2','emg'}; % label for
every column of data
mydata.trial{1} = mydatafromfile; % data in columns, channels in rows
mydata.time{1} = (1:size(mydatafromfile,1)) * 1/250; % create fake
time-axis, should be same length as data

If you are not able to program in MATLAB (yet), FieldTrip might not (yet)
be for you. In that case you can take a look at other MATLAB based software
such as e.g. EEGlab
<https://sccn.ucsd.edu/wiki/A01:_Importing_Continuous_and_Epoched_Data>or
Brainstorm <https://neuroimage.usc.edu/brainstorm/Introduction>, which use
GUIs for importing data that might help (I'm not familiar with them
though).

Out of curiosity, what hardware are you using? Build it yourself?

Good luck,
Stephen



On Thu, 29 Nov 2018 at 18:44, Hoang Truong <Hoang.Truong at colorado.edu>
wrote:

> Dear community,
>
> This is Tony, from CS Department, University of Colorado Boulder. I am new
> to eeg analysis and fieldtrip. Currently I work on recording eeg and emg
> data using our own hardware with 2 eeg and 2 emg channels respectively.
> Since we use our custom hardware, the data are saved in a simple format of
> txt file with 7 columns (example data on Dropbox: link
> <https://www.dropbox.com/s/30yzafa7ukg8xhl/Pressure_3_6.txt?dl=0>): 3
> first columns are data from environment sensors, the next 4 are eeg and emg
> data (250Hz sampling rate, 42s recording)
> I would like to ask what will be a proper way for me to import this data
> into fieldtrip. I checked the faq about importing custom data but I do not
> understand how to make custom readheader, readdata and readevent function.
> Any help would be appreciated (suggestions, code examples, etc).
> Thank you so much.
>
> Sincerely,
> Tony
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20181129/120eaab0/attachment.html>


More information about the fieldtrip mailing list