plotting a channel from a .mat file

조회 수: 12 (최근 30일)
Ross King
Ross King 2022년 9월 25일
답변: Image Analyst 2022년 9월 25일
I have a data file called data.mat and I am trying to plot the 23rd channel of this EEG data. The file contains 128 channels and each channel has 5120 samples. I looked up on mathworks how to do this but it just suggests to use the randn function which just gives you a matrix of pseudeorandom numbers (I think). How would I do this?
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2022년 9월 25일
@Ross King - when you read/load the data from the data.mat file, what are the dimensions of the (presumably) matrix? Is it 128x5120? If so, then just plot all of the data from the 23rd row as (for example)
myData = rand(128,5120); % using rand to generate some sample data only
plot(myData(23,:));
Please note that the rand in the above code is for illustration only and has nothing to do with the randn you mention in your question.

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2022년 9월 25일
You need to ignore rand and just plot your data.
If your data is in rows, you can do
plot(data(23, :), '-', 'LineWidth', 2); % Plot 23rd row.
grid on;
title('23rd row of data');
If your data is in rows, you can do
plot(data(:, 23), '-', 'LineWidth', 2); % Plot 23rd column
grid on;
title('23rd row of data');
If you have any more questions, then attach your mat file with the paperclip icon after you read this:

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by