Filter löschen
Filter löschen

Compiled App 'uigetfile' faulty behaviour?!

3 Ansichten (letzte 30 Tage)
Ellis Berry
Ellis Berry am 23 Aug. 2016
Kommentiert: David Barry am 25 Aug. 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 Kommentar
David Barry
David Barry am 25 Aug. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by