Modify GUI textbox from another script file?
Show older comments
Hello,
I am trying to update the text of a textbox via another function that performs an operation/does something. So under my GUI Opening function I have the following.
function Example_OpeningFcn(hObject, eventdata, handles, varargin)
handles = guidata(hObject); % Care for the newest version explicitly!
Test(hObject, handles);
handles = guidata(hObject); % Get the version updated in myFunction!
% Update handles structure
guidata(hObject, handles);
And then my function Test is something like this.
function Test(source, args, handles, hObject, eventdata)
%text = get(handles.Textbox1, 'string');
text = ['It Worked'];
%set(handles.Textbox1, 'string', text);
handles.Textbox1 = text
guidata(hObject, handles);
h = msgbox('Completed');
end
I am having trouble initializing text properly from what is in the textbox already and then needing to add a line, something like 'It Worked,' and then display it in the textbox.
I have been referencing this article but have gotten stuck. https://www.mathworks.com/matlabcentral/answers/66386-how-to-modify-the-handles-structure-gui-from-an-external-function Any assistance is appreciated!!
My current error is Not enough input arguments.
Error in Test (line 6) guidata(hObject, handles);
Accepted Answer
More Answers (0)
Categories
Find more on Financial Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!