Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Anurag Pujari
Anurag Pujari le 24 Déc 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 ?

Réponses (1)

Image Analyst
Image Analyst le 24 Déc 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)

Catégories

En savoir plus sur MATLAB Compiler dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by