Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

sir i have made a gui in which a push button gets images from folders of the computeers and i have a edit texts which shows the name of the image and i want to use that image for anothers pushbutton can you suggest me a way?

1 visualizzazione (ultimi 30 giorni)
[filename]=uigetfile({'*.jpg'},'File Selector');
image=strcat(filename);
axes(handles.axes1);
imshow(image);
set(handles.filename,'string',filename);
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
  1 Commento
Jan
Jan il 1 Giu 2015
Modificato: Jan il 1 Giu 2015
I've edited your code to improve the readability. Please use the "{} Code" button.
The question is not clear. "Use that image for another pushbutton"?
strcat(filename) does nothing - I assume you need the filepath in addition? See: help uigetfile.

Risposte (1)

Image Analyst
Image Analyst il 1 Giu 2015
Requiring users to type in the name of the file they want is not user friendly. Why don't you just load up a listbox of all the files that they might choose. See MAGIC: http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component
Also read the FAQ to see how you can transfer variables between callback functions: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by