set limits using xlim for strings
5 次查看(过去 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 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!