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

1 次查看(过去 30 天)
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 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by