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.
% 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