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

5 次查看(过去 30 天)
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 个评论
dpb
dpb 2014-7-25
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by