Effacer les filtres
Effacer les filtres

plotting a channel from a .mat file

18 vues (au cours des 30 derniers jours)
Ross King
Ross King le 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 commentaire
Geoff Hayes
Geoff Hayes le 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.

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 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