-1

i have a file : 30_19.1.20.eeg , which contains eeg data , i want to split this data into two halves . so first i imported the data file to matlab using the following : i imported a 30_19.1.vhdr file into eeglab using : file->import data -> using eeg functions and plugins -> from brain vis. Rec.vhdr or ahdr file

after that i received in the matlab workplace the following : enter image description here

so i want to open the data file so i pressed the EEG struct , this is what it contains : enter image description here and this struct contains a filed called data , when i open it i have a matrix that contains all of the data basically i want to split this data into half . how can i do such a thing ? i tried to change this struct but i always get the following error : enter image description here

mmolaan
  • 1
  • 3

2 Answers2

0

Structures are variables which have "sub-variables" called properties inside them, a bit like directory / sub-directory structures.

Assuming the data in your eeg variable is called data, you can do the following to load the data into a new variable: m = eeg.data. If you want to load half of that data, assuming the half is in terms of numbers of rows, then you could write:

m = eeg.data(1:floor(size(eeg.data,1)/2),:);
sg1234
  • 600
  • 4
  • 19
  • so now i have a new variable with the data i want , but now i want to save the changes that i have done in a new eeg file .. how can i do this ? – mmolaan Jun 15 '21 at 00:04
  • also this variable i think i should replace it with the old variable so everything could work – mmolaan Jun 15 '21 at 00:08
  • yes that is correct. simply update your eeg variable with the new data and save (look in matlab help for the "save" function) – sg1234 Jun 15 '21 at 00:11
  • i still have the same problem , because i still want to save these changes ( which means i want to save the changes in the eeg file so when i open it again i could see these changes ) , but if i press on save i still get the same error , it tells me that i can only save the variable itself , so it would save the variable in a new mat file , and thats not what i want ! i want to update the eeg file itself – mmolaan Jun 15 '21 at 00:25
  • you asked how to extract half of the data from your variable, and the above solution does that. if your question is now how to export an eeg file i do not know how to do that and suggest you read the manual of your eeg software in case it allows importing mat files. – sg1234 Jun 15 '21 at 00:36
0

You may want to "select data" from the continuous EEG dataset file. There are 2 options:

  • time range in seconds
  • point range (one-sample precision)

You have to apply this procedure twice (lower range, higher range) to get the 2 separate files.

After doing so, you can type EEG.history in the command window to get the Matlab code that has been executed.

enter image description here

marsei
  • 7,691
  • 3
  • 32
  • 41