Referencing a position for a subplot

조회 수: 1 (최근 30일)
Lui
Lui 2019년 6월 6일
댓글: Lui 2019년 6월 6일
Hi everyone, Can someone help me rewrite the code below so that each title on my subplot can reference the nth hour. For example the 24th plot should read like Hourly Variations for Hour 24 Demand. Unfortunately I cannot work around this. Thank you.
for n=1:24
for k=4
subplot(6,k,n)
plot(MJHourly(n,:));
hold on
plot(WJHourly(n,:));
hold off
xlabel('Day' );
ylabel('Demand');
title('Hourly Variations for Hour',n,'Demand')
end
end

채택된 답변

dpb
dpb 2019년 6월 6일
편집: dpb 2019년 6월 6일
title(sprintf('Hourly Variations for Hour %d Demand',n))
  댓글 수: 1
Lui
Lui 2019년 6월 6일
Thanks @dpq. Works perfectly

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by