Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Text on 3d plot won?t update

Subject: Text on 3d plot won?t update

From: Ironic Prata

Date: 6 Dec, 2009 05:06:03

Message: 1 of 2


I have a 3d plot. In each cycle i use the text command to place a number in the center of the plot.
The problem is that only the 1st number shows up, it wont replace on subsequent cycles.
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...

text(xo,yo,zo,num2str(distance),'BackgroundColor',[1 1 1],'FontSize',20);

How can i delete the previous text, without closing the window (i have a hold on, to keep points from previous cycles)?

Thank You

Subject: Text on 3d plot won?t update

From: Sadik

Date: 6 Dec, 2009 09:23:03

Message: 2 of 2

Hello,

What you can do is the following:

At each iteration:
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.].

2. Now put your text box.

3. Save your figure, or look at it, whatever you would like to do with it.

4. Before proceeding to the next iteration, say clf to clear the figure.

So, the pseudo code becomes

for k = 1:50
    for m = 1:k
          hold on
          make mth 3D plot
    end
    place text box with appropriate number
    do whatever you would like to do with the figure
    clf
end

Best.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us