how to use sprintf for xticklabel?
조회 수: 10 (최근 30일)
이전 댓글 표시
how to print
a = 0.1005:0.1:1.1005
as, 0.1, 0.2, 0.3, ... 1.0 for tickllabes?
I used sprintf command but the optput is not as expected.
ytl = sprintf('%.2f', 0.1005:0.1:1.1005);
ytl
0.100.200.300.400.500.600.700.800.901.001.10
How to give this as input to xticklabels?
댓글 수: 0
채택된 답변
Chunru
2022년 8월 15일
x = 0.1005:0.1:1.1005;
y = randn(size(x));
plot(x, y)
grid
% for x tick format
xtickformat('%.2f')
% Conversion of array to char array
ytl = sprintf('%.2f\n', 0.1005:0.1:1.1005)
댓글 수: 5
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!