I am trying to use guide and could use some help with functions in 2014a
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have a function "imgImport" which passes these output "im, hdr,old, datafile, hdrfile" but I can not grab this data in the next function. I noticed it is not propagating the data to the work space, and found that it is stored in the GUI. I have two buttons one to grab the image the second to crop the image; here is the function as I tried.
function pushbutton1_Callback(hObject, eventdata, handles)
%disp('imgImport')
[im, hdr,old, datafile, hdrfile]= imgImport;
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
[imgVIS, imgSWIR, rect,img,rowend, rowstart, colend, colstart]= cropping(im, hdr);
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
How do I get one button to grab outputs from the other buttons data.
0 Commenti
Risposta accettata
Geoff Hayes
il 2 Giu 2014
You can use the handles structure with the guidata function to store/save user data to the structure. Try something like this
function pushbutton1_Callback(hObject, eventdata, handles)
% call your script
[im, hdr,old, datafile, hdrfile]= imgImport;
% assign the user data to the structure
handles.im = im;
handles.hdr = hdr;
% save the data
guidata(hObject,handles);
Now in your other button callback, just access the data directly from the handles structure:
function pushbutton2_Callback(hObject, eventdata, handles)
[imgVIS, imgSWIR, rect,img,rowend, rowstart, colend, colstart] = …
cropping(handles.im, handles.hdr);
Try the above and see if that does what you wish.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox 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!