Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Problem with clearing text from axes
Replies: 7   Last Post: Jan 15, 2013 3:44 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kate J.

Posts: 177
Registered: 6/9/11
Problem with clearing text from axes
Posted: Jan 13, 2013 10:58 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have an animation using a Matlab s-function file called by my Simulink model. The animation is fine, but I?m trying to display a text phrase that needs to be cleared & reset each time a segment of the animation completes. My code is below (assume that any undefined variables are properly declared); the problem is that instead of correctly clearing the old text string & displaying the new string, the old text just gets overwritten so that the text area becomes a blurry mess.

I?ve reviewed the documentation, and it seems like using delete(textHandle) or clf(textHandle) should work; however, neither of these options is effective. Any suggestions about what I?m doing wrong? Thanks.


function Update(block)

% correctly-performing animation code here

% Add Task Number display
if (iteration == 0)
txtHandle = sprintf('Task #%d',taskNumber);
set(text(0.4,0.6,txtHandle), 'FontName', 'Arial', 'Color', [0,0,0]);
end

% this is the non-functional part
if(iteration == endVal)
delete(txtHandle);
end

drawnow;

end % end Update function



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.