Part of text disappears with 'text' & 'num2str' commands.

1 view (last 30 days)
Within a sublet I am just displaying text with a simulation name, and the day that it is on. In the day part, I use num2str to convert a rounded day to a string, and use that number within the 'text' function. See code below. The problem is, as the figures update with new times and results, the numers following 'day=' are somtimes cut off, or other parts are missing. Like sometimes the right edge of the 3'rd number doesnt show. Other times, the left edge of the second number doesnt appear. Help please!
subplot('position',[0.76 0.88 0.21 0.1],'box','on')%sublot position
set(gca,'xtick',[],'ytick',[]) %take axes ticks off
text(.4,.7,[sim(33:end)],'FontSize',13,'FontWeight','bold')%gives sim name
text(.3,.3,[' days=' ... ...num2str(round(tool(j)/3600/24*1000)/1000)],'BackgroundColor','w','FontSize',13,'FontWeight'......,'bold','Clipping','off') %%gives sim days
  1 Comment
dpb
dpb on 25 Jul 2014
Need the data required to make the symptom appear as well as just the code line(s).
First guess is that the width of the plot area is pretty small and the font size plus bold is pretty large so you're having spacing problems of having sufficient room for what you're trying to display.
Also, if you continually updating this, save the handles of the text objects the first pass and then update the 'String' property each subsequent pass instead of creating another new one with text.

Sign in to comment.

Answers (0)

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!