GUI problem while trying to call function from pushbutton1 to pushbutton2.

2 次查看(过去 30 天)
i want to access data from push button1 to push button2. here is my code
function pushbutton1_Callback(hObject, eventdata, handles)
[FileName,PathName] = uigetfile('*.avi');
PathOriginal=sprintf('%s%s',PathName,FileName);
readobj1=mmreader(PathOriginal);
readobj = readobj1;
%set(handles.pushbutton1,'UserData',readobj);
function pushbutton2_Callback(hObject, eventdata, handles)
%readobj=get(handles.pushbutton1,'UserData');
vidframes=read(handles.readobj);
numframes=get(readobj,'numberOfFrames');
when i run this file..i am getting error like this...any one please help me.
error message in command window:
Reference to non-existent field 'readobj'.
Error in ==> trying>pushbutton2_Callback at 96
vidframes=read(handles.readobj);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> trying at 43
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)trying('pushbutton2_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
this might looks like easy one. but i am new to gui design. so please help. whats going on here in call back functions. please help me. Thank you.

采纳的回答

Walter Roberson
Walter Roberson 2011-10-28
At the end of pushbutton1_Callback add the line
guidata(hObject, handles);
  3 个评论
Sandhu
Sandhu 2011-10-28
wowww........Walter it works grate. superb....
Thank you very much for you valuable help.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by