필터 지우기
필터 지우기

creating a matrix from a column vector

조회 수: 33 (최근 30일)
sam van Bohemen
sam van Bohemen 2019년 11월 20일
답변: Darshan Sen 2019년 11월 20일
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?

채택된 답변

Erivelton Gualter
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
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. :)

카테고리

Help CenterFile Exchange에서 Biomedical Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by