set limits using xlim for strings
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi, I wanted to know how to set string limits for a graph. I wanted to set axis limits as months of a year ('Jan' 'Feb 'Mar'). Also wanted to know whether I can pass an array or pass variable with predefined values in the xlim function. Thanks in advance.
댓글 수: 0
채택된 답변
Amit
2014년 2월 2일
set(gca,'XTick',1:12,'XTickLabel',{'Jan','Feb','Mar','Apr' .... etc})
댓글 수: 2
Image Analyst
2014년 2월 3일
Sure. You can make up a cell array with any string variables you want in it.
index = 1;
for y = 2009 : 2020
ca{index} = y; % or num2str(y) or sprintf('Year=%d', y) or whatever...
index = index + 1;
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!