필터 지우기
필터 지우기

Problem in files included in matlab compiler to convert to exe file

조회 수: 2 (최근 30일)
Anurag Pujari
Anurag Pujari 2014년 12월 24일
답변: Image Analyst 2014년 12월 24일
I have made an application where two signatures are compared. The code I used to import image is given below
a=uigetfile('*.png','Select signature');
After converting the code to exe file, the application imports only those image files which I have attached during packaging. How to import other files/images outside of the package or better say from anywhere in my hard drive ?

답변 (1개)

Image Analyst
Image Analyst 2014년 12월 24일
Most likely, you did not construct the full filename using the folder the user chose and so it looks only in the current folder (don't get me started on what that is for a compiled program - it's complicated). Use a snippet like this to construct the full file name:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by