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

 Akzeptierte Antwort

Alan Stevens
Alan Stevens am 31 Jan. 2024

0 Stimmen

Something like this
data = xlsread('sunHoursInTrollhattan.xlsx');
mins = data(:,1)*60 + data(:,2);
plot(1:12, mins,'o'),grid

Weitere Antworten (1)

Alan Stevens
Alan Stevens am 31 Jan. 2024

0 Stimmen

You have the hours as one plot and the minutes as the other!
Turn the data into all minutes, or all hours first.

1 Kommentar

Sergio
Sergio am 31 Jan. 2024
Bearbeitet: Sergio am 31 Jan. 2024
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2023b

Gefragt:

am 31 Jan. 2024

Kommentiert:

am 31 Jan. 2024

Community Treasure Hunt

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

Start Hunting!

Translated by