with cycle, changing the content of text
이전 댓글 표시
hi, matlab people
Is someone encountering the following case, or can anyone solve the following problem? any suggestion
I write a cycle to get lots of plots, at the same time I want to add text to these plots. The text content will change with the cycle.
thank you. help me please
댓글 수: 2
Fangjun Jiang
2011년 12월 31일
It can be done but I have no clue if you don't provide details.
petter
2012년 1월 1일
채택된 답변
추가 답변 (1개)
Walter Roberson
2011년 12월 31일
The usual techniques. Construct your text with sprintf(), or with num2str() and with [] concatenation operations.
text(3,5, sprintf('You sunk my %s!', ShipName))
댓글 수: 2
Walter Roberson
2012년 1월 1일
%d is for numeric values. Use %s for strings.
It appears you probably want two different lines of text. How do you want the two lines arranged relative to each other? Perhaps
text(14,0.5, {sprintf('Times=%s', name(1,:), sprintf('______%s', name(2,:)}, ...)
except using spaces instead of underscores. On the other hand since you are not using a fixed-sized font, getting the two lines aligned is going to be difficult.
Walter Roberson
2012년 1월 1일
There is no real need to keep doing those symbolic calculations. You do not have anything messy like integration. Your z value can be relatively easily calculated numerically based upon the input values. You can set the calculation up once symbolically and create a numeric function from it using matlabFunction. You can create the inputs to pass to matlabFunction using ndgrid. Possibly you might need to use a bxsfun() or two to handle d and f.
카테고리
도움말 센터 및 File Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!