time series and grouping
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I have a table with multiple sites (SITE_ID) and temperature time series associated with each site. Each site has a lat, lon and depth as well. I would like to group the data by SITE_ID, and then plot the tempearature time series associated with each site. TIMESTAMP is a string and TEMP_C is a double.
I know the first step is to group:
[G,ID]=findgroups(SITE_ID)
but am not sure how to plot associated time series for each unique site
Thank you!
댓글 수: 0
답변 (1개)
Eric Sofen
2020년 11월 12일
It's tough to give a detailed answer without seeing the structure of your data and preliminary code, but here are a few suggestions:
1) Convert your TIMESTAMPs to datetime.
2) You could use varfun to plot, using SITE_ID as a grouping variable. Something like
p = varfun(@(dt,temp) plot(dt,temp), t, 'InputVariables',{'TIMESTAMP','TEMP_C'},'GroupingVariables','SITE_ID')
It will actually return a table with the line objects for the charts. If you use hold on, you can get all the plots on one chart.
3) If you want subplots, you're right that you're probably better off iterating over the unique values of SITE_ID.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!