plotting a channel from a .mat file

10 ビュー (過去 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 Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by