Manipulation of data for plotting
1 view (last 30 days)
Show older comments
Rudy Steel
on 26 Dec 2020
Commented: Cris LaPierre
on 26 Dec 2020
When opening raw data obtained from github I found it to be of a 4D structure. So basically, the dataset that I am using being s9.mat is of size 12 x 8 x 1114 x 15:
[Number of targets, Number of channels, Number of sampling points, Number of trials] = size(eeg)
From the github site it is being told that the stimulation was shown at the 39th sample so I need to ignore the first 38 samples when processing, reducing the data to 12 x 8 x 1076 x 15. I also need to consider only the first 10 trials so I will be working on a dataset of size 3 x 8 x 1076 x 10. I require to process this data (filtering etc) however to do so I first have to extract from the dataset a 1 x 1076 vector, which represents one trial (corresponding to a stimulus frequency of 9.25Hz, recorded at one of the 8 channels) and then I can apply my filter to this vector of data.
So my problem is how I can obtain the 1 x 1076 vector so that I could proceed with further processing. Would appreciate if anyone can guide me as to how I can obtain this vector.
0 Comments
Accepted Answer
Cris LaPierre
on 26 Dec 2020
Edited: Cris LaPierre
on 26 Dec 2020
Not sure how you went from 12 to 3 in your first dimension, but use indexing to reduce your data down to 12 x 8 1076 x 10.
newVar = origData(:,:,39:end,1:10)
To extract a single stimulation from a single target and a single channel for a single trial, you could do this.
% 1076 points from target 1, channel 2, trial 3
singleStim = origData(1,2,39:end,3)
To make it 1x1076, you might need to enclose everything in the function squeeze
singleStim = squeeze(origData(1,2,39:end,1))
2 Comments
Cris LaPierre
on 26 Dec 2020
This is because squeeze removes all the singleton dimensions, which leaves you with 1076. It keeps that as the first dimension and adds the "x1" since it has to have a second dimension.
You just need to transpose the result using an apostrophe.
a = [1;2;3;4;5]
b = a'
More Answers (0)
See Also
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!