plotting a channel from a .mat file

10 Ansichten (letzte 30 Tage)
Ross King
Ross King am 25 Sep. 2022
Beantwortet: Image Analyst am 25 Sep. 2022
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 Kommentar
Geoff Hayes
Geoff Hayes am 25 Sep. 2022
@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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 25 Sep. 2022
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:

Community Treasure Hunt

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

Start Hunting!

Translated by