Borrar filtros
Borrar filtros

Compiled App 'uigetfile' faulty behaviour?!

3 visualizaciones (últimos 30 días)
Ellis Berry
Ellis Berry el 23 de Ag. de 2016
Comentada: David Barry el 25 de Ag. de 2016
Hi all,
I have compiled my app and I am having issues with it, even though it works perfectly fine when running the script in Matlab before I compile it using 'Application compiler'.
On one of the pushbutton's, I click it and it is meant to open a search box to choose an image you want (uigetfile). When you choose an image it should load to an axes (axes1). Now, if I put a specific image into the same folder as the compiled .exe it works fine, but I want to be able to get images from any directory???
Any Ideas?
Here is my code for the pushbutton:
% --- Executes on button press in pushbutton1. CHOOSE CROP AREA
function pushbutton1_Callback(hObject, eventdata, handles)
% 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)
filename = uigetfile('*.*');
myimage = imread(filename);
axes(handles.axes1);
Many thanks in advance,
Ellis
  1 comentario
David Barry
David Barry el 25 de Ag. de 2016
I don't understand the problem. Is the uigetfile window not being displayed in your compiled app? Don't forget that uigetfile will default to opening in your current directory. This might not be where you expect in a compiled app. You could cd to a different folder before calling uigetfile and then cd back again after if you want to always default to a specific folder.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by