I'm using MATLAB GUIDE to create a simple GUI. I'd like to know which uicontrol
I should use to show some results: editable text or static text. In addition, I don't want the new results to replace the old ones.
views:
525answers:
2
+1
A:
static, because you don't want user to be able to edit it (i guess).
SilentGhost
2009-04-23 14:04:18
+3
A:
I would use a static text box, since I doubt you want the user to modify any of the text.
If you are appending results to a static text box, you should first get the old text contained in the text box (if you don't have it stored in another variable already). Then append the new text to that and update the static text box. For example:
hText = uicontrol('Style','text','String','This is my text string.');
newString = 'Add this line!';
set(hText,'String',strvcat(get(hText,'String'),newString));
I think this will work in general. However, if you have set the string to be a cell array, you may have to use the following instead of the last line above:
set(hText,'String',[get(hText,'String') {newString}]);
To find out more about the 'String' property, you can check out the MATLAB documentation for uicontrol properties here.
gnovice
2009-04-23 15:26:56