Plot data to a certain date with array

Sorry I am new to coding! Apologies if this is a dumb question.
I a years worth of data and an array saying 1 when it is january and 0 when its not. I need to plot data only when its january, but im unsure how to work in the array into my plot.
Thanks!

답변 (1개)

Peter Perkins
Peter Perkins 2021년 11월 29일

0 개 추천

Give this a try:
>> tt = timetable((1:365)','RowTimes',datetime(2021,1,1:365))
tt =
365×1 timetable
Time Var1
___________ ____
01-Jan-2021 1
02-Jan-2021 2
03-Jan-2021 3
[snip]
29-Dec-2021 363
30-Dec-2021 364
31-Dec-2021 365
>> jan = tt.Time.Month == 1;
>> plot(tt.Time(jan),tt.Var1(jan))

댓글 수: 3

PureFleet
PureFleet 2021년 11월 29일
this is similar to what i was thinking however the data is in increments of 10 minutes per day so theres over 5000 lines of data. I am unsure on how to plot the data when the array just equals on and not when it equals 0.
PureFleet
PureFleet 2021년 11월 29일
nvm did it by adding (plotindex) at the end of each data
IIUC, my "jan" variable was the same as your "plotindex".

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2021년 11월 29일

댓글:

2021년 12월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by