save variables gui
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Hellow, i want to save variables in my gui witch i ask in a checkbox,listbox,edit text and so on... i know how to select it, but i want to save it so i can use it in another gui and other functions. After help i used this form but i get the next error. Please help!
function ls_Callback(hObject, eventdata, handles)
  % hObject    handle to ls (see GCBO)
  % eventdata  reserved - to be defined in a future version of MATLAB
  % handles    structure with handles and user data (see GUIDATA)
  ls = str2double(get(hObject,'String')) %to convert to double
  handles.ls = ls;
  guidata(handles);
To use it i try: handles = guidata(YourFigureNumber); and then use handles.ls this is the error message:
        ??? Error using ==> guidata at 89
        H must be the handle to a figure or figure descendent.
        Error in ==> DA>ls_Callback at 444
        guidata(handles);
        Error in ==> gui_mainfcn at 96
                feval(varargin{:});
        Error in ==> DA at 42
            gui_mainfcn(gui_State, varargin{:});
        Error in ==> @(hObject,eventdata)DA('ls_Callback',hObject,eventdata,guidata(hObject))
        ??? Error while evaluating uicontro  l Callbac
0 Commenti
Risposte (2)
  Paulo Silva
      
 il 8 Mag 2011
        Make sure that YourFigureNumber is really one handle to a figure, figure1 usually works to specify the GUI figure handle.
0 Commenti
  Walter Roberson
      
      
 il 8 Mag 2011
        Within the context of a callback for the same figure, you can replace YourFigureNumber with hObject.
0 Commenti
Vedere anche
Categorie
				Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


