フィルターのクリア

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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by