Effacer les filtres
Effacer les filtres

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

3 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Oct 2011
At the end of pushbutton1_Callback add the line
guidata(hObject, handles);
  3 commentaires
Walter Roberson
Walter Roberson le 28 Oct 2011
Ah, your line
readobj = readobj1;
should be
handles.readobj = readobj1;
Sandhu
Sandhu le 28 Oct 2011
wowww........Walter it works grate. superb....
Thank you very much for you valuable help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by