Assign a value to a static text in GUI MATLAB

霸气de小男生 提交于 2019-12-09 14:58:06

问题


How can I assign a value to a static text in a MATLAB GUI?


回答1:


Double click on your text in guide to open the property editor, then edit the 'String' property. You can also set the 'Tag' property so you can edit it while your GUI is running. If you set your tag to mytext, you can change the static text to 'MyString' with the following line:

set(handles.mytext,'String','MyString')



回答2:


So that didn't work for me. However, after setting the tag as above the following would work:

set(findobj('Tag','mytext'),'String','MyString')



回答3:


Try this, considering that name and last_name are global, just for example:

<code>
global name last_name 
var1 = findobj(gcbf,'Tag','nomb');
var2 = findobj(gcbf,'Tag','ap');

data1 = char(name);
data2 = char(last_name);

set (var1, 'String', data1 );
set (var2, 'String', data2 );
</code>

Also consider thatr nomb and ap are Static Text



来源:https://stackoverflow.com/questions/2924488/assign-a-value-to-a-static-text-in-gui-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!