How do I load and plot the .mat file

44 ビュー (過去 30 日間)
Junzhen Liu
Junzhen Liu 2021 年 11 月 5 日
コメント済み: Junzhen Liu 2021 年 11 月 5 日
How do I plot it out? Thank you for anyone who can help
  4 件のコメント
Jan
Jan 2021 年 11 月 5 日
This cannot work:
load('A1S1.mat', '_1_Time')
Names of variables cannot start with an underscore.
What is the contents of the mat file?
data = load('A1S1.mat')
Junzhen Liu
Junzhen Liu 2021 年 11 月 5 日
Sorry, I just update the file, can you check again?

サインインしてコメントする。

回答 (1 件)

DGM
DGM 2021 年 11 月 5 日
編集済み: DGM 2021 年 11 月 5 日
This is one way:
S = load('lab31part1.mat');
t = S.lab3_part1_Time;
v = S.lab3_part1_Value;
subplot(2,1,1)
plot(t(:,1),v(:,1))
grid on
subplot(2,1,2)
plot(t(:,2),v(:,2))
grid on
Or if you want them in the same axes:
clf % just to reset web-plot
S = load('lab31part1.mat');
t = S.lab3_part1_Time;
v = S.lab3_part1_Value;
plot(t,v)
grid on
  1 件のコメント
Junzhen Liu
Junzhen Liu 2021 年 11 月 5 日
OMG, thank you so much

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by