creating a matrix from a column vector
44 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sam van Bohemen
am 20 Nov. 2019
Beantwortet: Darshan Sen
am 20 Nov. 2019
I want to analyse some EEG data by breaking the total samples into 1 second segments. The total number of samples for each channel is 136704. The sampling rate of the EEG device is 128Hz, therefore I want to create segments of data with 128 samples. This will result in 1068 segments for each channel.
The total samples for one channel = x
How can I create a 128 x 1068 matrix from x? So each coulmn represents 1 second (128 samples) of the total samples?
0 Kommentare
Akzeptierte Antwort
Erivelton Gualter
am 20 Nov. 2019
Lets say you have your signal (EEG_signal):
EEG_signal = rand(1,136704); % Sample SIgnal
You can reshape this on matrix format:
EEG_signal_matrix = reshape(x, 128, 1068);
Weitere Antworten (1)
Darshan Sen
am 20 Nov. 2019
Hello Sam. I guess we can solve your problem using the reshape function that MATLAB provides.
I'll walk you through a very simple example where, I am considering x to be a -dimensional column vector and I'll reshape it into a matrix with 3 rows and 5 columns and store it in y.
>> x = rand(15, 1)
x =
0.3044
0.6476
0.1739
0.0302
0.6322
0.3122
0.6367
0.6452
0.4710
0.2619
0.1978
0.6550
0.0990
0.5368
0.9916
>> y = reshape(x, 3, 5)
y =
0.3044 0.0302 0.6367 0.2619 0.0990
0.6476 0.6322 0.6452 0.1978 0.5368
0.1739 0.3122 0.4710 0.6550 0.9916
If this is the kind of functionality you want, you may change the dimensions and fill in your own data.
If you want to know more about the reshape function, you may type help reshape into the MATLAB console and I'm sure it'll guide you well.
Hope this helps. :)
0 Kommentare
Siehe auch
Kategorien
Mehr zu EEG/MEG/ECoG finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!