printing value of a variable in a plot at some fixed coordinates
조회 수: 82 (최근 30일)
이전 댓글 표시
Hi,
I want to plot a graph and then print values of variables at some fixed coordinates each time inside a loop:
%Some initial values
T = 10; nts = 10000;
for a = 1:10
for c = 1:10
[SE, SH, EE, EH, Efeval, Hfeval] = HeunvsEuler(a, c, T, nts);
plot(sign(norm(EE,inf)-norm(SH,inf)),'*');
%I want a function here which can print values of a and c just beside * in above plot
end
end
I know there is a function 'text' but it prints only a fixed string. I need something like 'fprintf' which can print values of variables. Please suggest.
Thanks Ashish
댓글 수: 0
채택된 답변
Honglei Chen
2012년 3월 8일
You can use text with num2str or sprintf
doc text
doc num2str
doc sprintf
for example
text(x,y,sprintf('VARNAME=%f',VARNAME))
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!