to convert .events to .mat

1 view (last 30 days)
Ajay Kumar
Ajay Kumar on 12 Jul 2023
Answered: Ajay Kumar on 13 Jul 2023
Hi everyone,
I have openephys recorded files including .continuous and .events.
i am trying to convert .event to .mat using this code.
file_path = 'C:\Users\Documents\Data;
event_data = loadOpenEphysEvents(file_path);
% Extract start and end times
event_start_times = event_data(:, 1);
event_end_times = event_data(:, 2);
for i = 1:length(event_start_times)
disp(['Event ', num2str(i), ': Start Time - ', num2str(event_start_times(i)), ', End Time - ', num2str(event_end_times(i))]);
end
after running this code i am getting this output
Event 1: Start Time - 0, End Time - 0
Event 2: Start Time - 0, End Time - 0
Event 3: Start Time - 0, End Time - 0
Event 4: Start Time - 0, End Time - 0
Event 5: Start Time - 0, End Time - 0
Event 6: Start Time - 0, End Time - 0
Event 7: Start Time - 0, End Time - 0
Event 8: Start Time - 0, End Time - 0
Event 9: Start Time - 0, End Time - 0
Event 10: Start Time - NaN, End Time - NaN
Event 11: Start Time - NaN, End Time - NaN
Event 12: Start Time - NaN, End Time - NaN
Event 13: Start Time - NaN, End Time - NaN
Event 14: Start Time - NaN, End Time - NaN
Event 15: Start Time - NaN, End Time - NaN
how can i extract event start time and end time?

Answers (2)

Satwik
Satwik on 13 Jul 2023
Edited: Satwik on 13 Jul 2023
Hi Ajay,
I understand that you are having trouble loading a .event file in MATLAB and parsing it to get the data.
First, check your code to make sure that the file_path variable has a closing quotation mark. If it does not, the code will not be able to find the file.
If the issue still exists then there are a few checks you can do
  1. You can check the loadOpenEphysEvents function to see if it is returning any data/
  2. Finally, you can verify that the data is a 2-column array
If you are still having trouble after making these changes, please provide me with the openephys file itself and I will be happy to take a look at it.
I hope this helps!

Ajay Kumar
Ajay Kumar on 13 Jul 2023
Hi Satwik,
Thank you for your help, really apreciated.
I ttried all i am still facing probplem.
I am attching the .event file.
looking forward hearning from you.
Thanks you.

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!