matlab - pass handle from one m file to other m file -


from "main" window have button opens window "list". in list window have 2 listboxes 1 on left has names on , on 1 on right add names it. unable pass added names list "main" window once click ''ok" button on "list" window.

function done_button_callback(hobject, eventdata, handles)      selectedfaults = get(handles.selectedfaults_listbox,'string');       set(main, handle.faults_listbox,'string',selectedfaults)        close(insert_fault) 

the error i'm getting is:

 ??? no appropriate method, property, or field faults_listbox class handle.  error in ==> insert_fault>done_button_callback @ 380  set(main, handle.faults_listbox,'string',selectedfaults)  error in ==> gui_mainfcn @ 96     feval(varargin{:});   error in ==> insert_fault @ 42  gui_mainfcn(gui_state, varargin{:}); ??? error while evaluating uicontrol callback 

both m files in same directory. i'm stuck. thank help

your code not show how variable "handle" defined. did mean "handles"? in case, handles structure 1 comes insert_fault figure, , has nothing handles structure of main figure.

if want modify listbox in main window, pass handle of faults_listbox main figure insert_fault figure, example via userdata or appdata.

the following code should want.

in main:

% callback of button in main opens insert_fault figure function open_insert_fault_callback(hobject, eventdata, handles) insert_fault('userdata', struct('mainhandles', handles)); 

in insert_fault:

function done_button_callback(hobject, eventdata, handles) selectedfaults = get(handles.selectedfaults_listbox,'string');    userdata=get(handles.figure1, 'userdata'); mainhandles=userdata.mainhandles;  set(mainhandles.faults_listbox,'string',selectedfaults)    close(insert_fault) 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -