Reshape EEG data to wide format with new aggregate column names
I’m using EEG lab to calculate relative spectral power for various bands. This went well, but now I’m stuck on how to reshape this the way I need it. I have 20 participants, and I want each participant to have only one row of data.
As such, I’m trying to convert this matrix so that the columns are a combination of electrode and frequency band. For example, each participant would have one row of data with columns labelled F7.relativeAlpha, F7.relativeBeta, and so on (see below for example). Any help would be greatly appreciated! I added an example of what I’m trying to create vs what I have currently.
I’ve tried unsuccessfully with the reshape function and with the unstack function.
RelativePowerWide = unstack(RelativePowerResults,’ID’,’RelativeDelta’)I’m using EEG lab to calculate relative spectral power for various bands. This went well, but now I’m stuck on how to reshape this the way I need it. I have 20 participants, and I want each participant to have only one row of data.
As such, I’m trying to convert this matrix so that the columns are a combination of electrode and frequency band. For example, each participant would have one row of data with columns labelled F7.relativeAlpha, F7.relativeBeta, and so on (see below for example). Any help would be greatly appreciated! I added an example of what I’m trying to create vs what I have currently.
I’ve tried unsuccessfully with the reshape function and with the unstack function.
RelativePowerWide = unstack(RelativePowerResults,’ID’,’RelativeDelta’) I’m using EEG lab to calculate relative spectral power for various bands. This went well, but now I’m stuck on how to reshape this the way I need it. I have 20 participants, and I want each participant to have only one row of data.
As such, I’m trying to convert this matrix so that the columns are a combination of electrode and frequency band. For example, each participant would have one row of data with columns labelled F7.relativeAlpha, F7.relativeBeta, and so on (see below for example). Any help would be greatly appreciated! I added an example of what I’m trying to create vs what I have currently.
I’ve tried unsuccessfully with the reshape function and with the unstack function.
RelativePowerWide = unstack(RelativePowerResults,’ID’,’RelativeDelta’) wide format, eeg, reshape, unstack MATLAB Answers — New Questions