matlab:有很好的MyBox控件,用文本框
我的问题是我想要一个框,用于在图表中添加更大的注释。 如何创建此框,使其始终位于图形外部的右下侧,并根据内部文本量自动调整其大小?此外,如果我将有更长的文本,我需要它被分成更多的行,而不仅仅是一行非常长 我这样使用它,但是我对发生的事情控制不好,这只是在某个地方创建了一个特定的大小,文本被剪切。。请帮忙:)matlab:有很好的MyBox控件,用文本框,matlab,graph,annotations,plot,Matlab,Graph,Annotations,Plot,我的问题是我想要一个框,用于在图表中添加更大的注释。 如何创建此框,使其始终位于图形外部的右下侧,并根据内部文本量自动调整其大小?此外,如果我将有更长的文本,我需要它被分成更多的行,而不仅仅是一行非常长 我这样使用它,但是我对发生的事情控制不好,这只是在某个地方创建了一个特定的大小,文本被剪切。。请帮忙:) 恐怕您无法自动执行此操作-文本框不使用回调。从文件中: 用户不能以交互方式更改静态文本。静态文本控件在单击时不激活回调例程 您可以调用textwrap函数,该函数将自动包装您传递给它的文本,
恐怕您无法自动执行此操作-文本框不使用回调。从文件中: 用户不能以交互方式更改静态文本。静态文本控件在单击时不激活回调例程 您可以调用textwrap函数,该函数将自动包装您传递给它的文本,并返回新的文本框位置:
MyBox = uicontrol('style','text');
% set initial position - first three values are kept constant after wrap, the hight can be changed
set(MyBox,'Position',[10,10,30,10])
% adjust the height of your Text box and wrap the text
[outstring,newpos] = textwrap(MyBox,{'optional longer information to be put into diagram'});
% set new position and text
set(MyBox,'Position',newpos, 'String', outstring)
无论何时更改文本框中的字符串,都必须调用textwrap并自行设置(…)
MyBox = uicontrol('style','text');
% set initial position - first three values are kept constant after wrap, the hight can be changed
set(MyBox,'Position',[10,10,30,10])
% adjust the height of your Text box and wrap the text
[outstring,newpos] = textwrap(MyBox,{'optional longer information to be put into diagram'});
% set new position and text
set(MyBox,'Position',newpos, 'String', outstring)