フィルターのクリア

Two graphs in the same plot, why?

2 ビュー (過去 30 日間)
Sergio
Sergio 2024 年 1 月 31 日
コメント済み: Sergio 2024 年 1 月 31 日
Hi, I imported some data from an xls file, and when plotting it , I obtain two graphs in the plot. Only one is necessary. What is the other and why does it appear?
xlsread('sunHoursInTrollhattan.xlsx')
plot(ans)
xlabel('måned')
ylabel('timer')
title('Soltimar i Trollhattan')
Thanks

採用された回答

Alan Stevens
Alan Stevens 2024 年 1 月 31 日
Something like this
data = xlsread('sunHoursInTrollhattan.xlsx');
mins = data(:,1)*60 + data(:,2);
plot(1:12, mins,'o'),grid
  1 件のコメント
Sergio
Sergio 2024 年 1 月 31 日
Thanks Allan!

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

その他の回答 (1 件)

Alan Stevens
Alan Stevens 2024 年 1 月 31 日
You have the hours as one plot and the minutes as the other!
Turn the data into all minutes, or all hours first.
  1 件のコメント
Sergio
Sergio 2024 年 1 月 31 日
編集済み: Sergio 2024 年 1 月 31 日
How can I do that? I tried
T=readtable('sunHoursInTrollhattan.xlsx',Range="A2:B13",ReadVariableNames=false)
ans=plot(T.Var1,T.Var2)
xlabel('Måned');
ylabel('Timar');
title('Soltimar i Trollhattan');
but that didn't work

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

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by