http://www.mathworks.com/matlabcentral/newsreader/view_thread/267736
MATLAB Central Newsreader  Text on 3d plot won?t update
Feed for thread: Text on 3d plot won?t update
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Sun, 06 Dec 2009 05:06:03 +0000
Text on 3d plot won?t update
http://www.mathworks.com/matlabcentral/newsreader/view_thread/267736#700177
Ironic Prata
<br>
I have a 3d plot. In each cycle i use the text command to place a number in the center of the plot.<br>
The problem is that only the 1st number shows up, it wont replace on subsequent cycles. <br>
In other cycles, if the number is larger than the previous one, the last digits will show up in the end of the 1st number, so i know i am really doing a another text command...<br>
<br>
text(xo,yo,zo,num2str(distance),'BackgroundColor',[1 1 1],'FontSize',20);<br>
<br>
How can i delete the previous text, without closing the window (i have a hold on, to keep points from previous cycles)?<br>
<br>
Thank You

Sun, 06 Dec 2009 09:23:03 +0000
Re: Text on 3d plot won?t update
http://www.mathworks.com/matlabcentral/newsreader/view_thread/267736#700195
Sadik
Hello,<br>
<br>
What you can do is the following:<br>
<br>
At each iteration:<br>
1. Plot everything up until that time. [Since you are using the hold on command, I am assuming that you are making 3d plots on top of each other. If you have 50 plots to plot this way and this is your 5th iteration [or equivalently, 5th plot], then you will plot your first 5 plots. At the nth iteration, you will plot the first n plots using hold on, but not putting the text box.].<br>
<br>
2. Now put your text box.<br>
<br>
3. Save your figure, or look at it, whatever you would like to do with it.<br>
<br>
4. Before proceeding to the next iteration, say clf to clear the figure.<br>
<br>
So, the pseudo code becomes<br>
<br>
for k = 1:50<br>
for m = 1:k<br>
hold on<br>
make mth 3D plot<br>
end<br>
place text box with appropriate number<br>
do whatever you would like to do with the figure<br>
clf<br>
end<br>
<br>
Best.