Control a GUI (push button) from a script
8 次查看(过去 30 天)
显示 更早的评论
I have a GUI ('GUI1') which I want to control with a script. As I am not the owner nor administrator of 'GUI' I cannot change anything in the source code, however I do have access to it.
I would like to run 'GUI1' in the background, controlling it with my script. So far I have found the object handle via "findall" using the Tag. I tried to press the push button via the callback, however, it would not execute since it had not enough input arguments. This is the error that came:
feval(@(hObject,eventdata)ETD_Datamaster('File_browse_Callback',hObject,eventdata,guidata(hObject)))
Error using @(hObject,eventdata)GUI1('File_browse_Callback',hObject,eventdata,guidata(hObject))
Not enough input arguments.
What are the possibilities for controlling a GUI from a script? Has anyone done this before
0 个评论
采纳的回答
Walter Roberson
2015-11-7
You are passing a function handle to feval, and the function handle requires two arguments, but you are not providing any arguments.
file_browse_button_handle = findall('Tag', 'File_browse');
cb = get(file_browse_button_handle, 'Callback');
%now invoke the callback. hObject will be the button's own handle
cb(file_browse_button_handle, []); %uicontrol pushbutton have empty event
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!