Borrar filtros
Borrar filtros

plotting a channel from a .mat file

18 visualizaciones (últimos 30 días)
Ross King
Ross King el 25 de Sept. de 2022
Respondida: Image Analyst el 25 de Sept. de 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 comentario
Geoff Hayes
Geoff Hayes el 25 de Sept. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 25 de Sept. de 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:

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by