Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Anurag Pujari
Anurag Pujari el 24 de Dic. de 2014
Respondida: Image Analyst el 24 de Dic. de 2014
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 ?

Respuestas (1)

Image Analyst
Image Analyst el 24 de Dic. de 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)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by