unix timestamp in EEG data using labstreaminglayer

90 views (last 30 days)
Lax
Lax on 28 Oct 2025 at 17:38
Edited: Cris LaPierre on 30 Oct 2025 at 14:08
Hello all,
I am currently working on the neuromarketing data available on this link. https://figshare.com/articles/dataset/NeuMa_Raw_A_multimodal_Neuromarketing_dataset/22117001/3 and it is described in this article https://www.nature.com/articles/s41597-023-02392-9. According to the authors, they have used https://github.com/labstreaminglayer/App-LabRecorder to record the data. I am struggling to understand how the timestamps work. In the article, the authors say they use unix timestamps and the timestamps has the form: 3.329729360250185e+05. I try to convert it back using the function datetime(t, 'ConvertFrom', 'posixtime') but it is giving me something non sense. Is there someone who has worked on this data or can help me with this?
Thank you very much in advance
  11 Comments
dpb
dpb on 29 Oct 2025 at 18:29
Edited: dpb on 30 Oct 2025 at 13:07
There's a link to some m-files to process the EEG and other data streams; surely inside there will be the code to deal with the time stamps? Or, as @Cris LaPierre notes, they didn't use it, either.
This is not really a MATLAB-related issue at all, however...is there not some other users' group for which the Q? about the data structure itself would be more appropriate (and more likely to find somebody who actually knows)?
As far as the segments being of any given length, the sampling rate is given for each signal (some were 300 Hz, eye movement 120(?) Hz, I think I recall seeing). So, you can compute the length of the signal by the product of the sampling interval times a number of samples regardless of the time stamp itself. From that you then could probably back calculate what the time stamps are.
FsEEG=300; % EEG sampling rate
dt=1/FsEEG; % EEG sample time, s
3/dt % Samples/3 sec
ans = 900.0000
3*300 % or Seconds * samples/S ==> samples, too.
ans = 900
But, the actual date/time the data were taken would be totally immaterial to any analysis.
Cris LaPierre
Cris LaPierre on 30 Oct 2025 at 14:08
Edited: Cris LaPierre on 30 Oct 2025 at 14:08
Between sample rate and number of samples, you can determine which segments are less than 3 seconds.
load ET_stream.mat
fs = str2double(ET_stream.info.nominal_srate)
fs = 600
nS = str2double(ET_stream.info.sample_count)
nS = 43199
segLength = nS/fs % length in seconds
segLength = 71.9983
I don't know enough about the equipment to know if it makes more sense to use nominal_srate or effective_srate. I selected nominal because that is what is used in the RawDataProcessing.mlx file.

Sign in to comment.

Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!