creating a matrix from a column vector
43 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Erivelton Gualter
2019 年 11 月 20 日
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);
その他の回答 (1 件)
Darshan Sen
2019 年 11 月 20 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で EEG/MEG/ECoG についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!