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

조회 수: 3 (최근 30일)
Jonathan Taylor
Jonathan Taylor 2014년 7월 25일
댓글: dpb 2014년 7월 25일
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