Assign a value to a static text in GUI MATLAB
Asked Answered
C

3

11

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

Camera answered 27/5, 2010 at 20:6 Comment(0)
H
21

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')
Helfrich answered 27/5, 2010 at 20:9 Comment(0)
J
0

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

set(findobj('Tag','mytext'),'String','MyString')
Junitajunius answered 27/4, 2014 at 18:52 Comment(0)
G
0

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

Grim answered 7/4, 2016 at 23:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.