필터 지우기
필터 지우기

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개)

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 CenterFile Exchange에서 2-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