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

1 view (last 30 days)
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 ?

Answers (1)

Image Analyst
Image Analyst on 24 Dec 2014
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)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!