Adding sentences with calculated numbers to a plot
이전 댓글 표시
I want to add 3 sentences with a calculated numbers underneath a plot. I tried using a second line in the x-label, which works, but it doesn't calculate the number. Is this even possible?
댓글 수: 2
madhan ravi
2018년 9월 5일
can you describe by pasting your code and what's your desired output?
답변 (1개)
Star Strider
2018년 9월 6일
Example —
x = 1:10;
y = rand(1,10);
AB = rand(1,2);
figure
plot(x, y)
xext = get(gca, 'XLim');
yext = get(gca, 'YLim');
text(1.4*xext(1), yext(1)-0.1*diff(yext), sprintf('The value of A is %.3f\nThe value of B is %.3f', AB))
Experiment to get the result you want.
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!