Effacer les filtres
Effacer les filtres

Compiled App 'uigetfile' faulty behaviour?!

3 vues (au cours des 30 derniers jours)
Ellis Berry
Ellis Berry le 23 Août 2016
Commenté : David Barry le 25 Août 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 commentaire
David Barry
David Barry le 25 Août 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by