필터 지우기
필터 지우기

Compiled App 'uigetfile' faulty behaviour?!

조회 수: 3 (최근 30일)
Ellis Berry
Ellis Berry 2016년 8월 23일
댓글: David Barry 2016년 8월 25일
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
David Barry
David Barry 2016년 8월 25일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by