Using for loop for plotting from a timetable?
조회 수: 2 (최근 30일)
이전 댓글 표시
Attached is a sample of my data that I would like to plot. I would like to use for loop to automate plotting from the timetable directly. Below is my code, however, it seems there is some problem. any thoughts would be appreciated. I would also like to get a handle to enhance the plot further.
for ii=1:2
plot(TT2.Date,TT2.(:,ii))
end
댓글 수: 0
채택된 답변
Walter Roberson
2017년 12월 23일
편집: Walter Roberson
2017년 12월 23일
plot(TT2.Date, TT2{:,ii})
... and remember the "hold on"
댓글 수: 0
추가 답변 (1개)
Peter Perkins
2017년 12월 28일
I imagine that
plot(TT2.Date,TT2{:,1:2})
would also work. And if there's only two variables in your timetable, that's equivalent to
plot(TT2.Date,TT2.Variables)
where "Variables" is the default name to use, but it's whatever TT2.Properties.DimensionNames{2} is set to.
댓글 수: 2
Peter Perkins
2018년 1월 5일
You only think you want a loop. This
plot(TT2.Date,TT2{:,1:2})
plots them both at once, without a loop.
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!