Supporting files are not working in deployed .exe

Hi
I have generated a package with some GUIs and functions and some supporting files like shapefiles, images etc.
But after deploying that package into .exe form, supporting shapefiles (.shp) files are not working. Then I have tried to use them by converting into matrix (.mat)file, but then also its not working.
Why MATLAB deployed .exe is not able to read .shp and .mat files?
Please help me out in this regard. Any sort of help is appreciated.
Thanks in advance.

 Réponse acceptée

Image Analyst
Image Analyst le 14 Juil 2013

0 votes

Chances are you didn't specify the full filename of the files and just ignored any folder and assumed the file will be in the same folder as the executable. Bad assumption. For this to even have a chance of working, you'd have to bundle the files with the executable with the -a option. The reason is that the executable you think you are running is not the real executable but a self-unarchiving program that unpacks the real executable somewhere else but does not copy everything else (like the special files you shipped) in that folder to there. Better is to put these files into a known folder, then use fullfile() to construct the full path name of the file, and use exist(fullFileName, 'file') to check that the file exists before you try to do anything with it. It's just robust programming.

5 commentaires

rahul
rahul le 17 Juil 2013
Modifié(e) : rahul le 17 Juil 2013
Thanks for the reply image analyst, but it did not work. Please find the below my code and how I called shapefiles by using fullfile() as suggested by you.
%Construct file path------------
f = fullfile('C:','Users','ICRS','Desktop','package','shapefile');
% Check existance -------------------------------------------
shp_dec=exist([f,'\IND_adm1.shp']);
if shp_dec==2
uiwait(msgbox('file exists','modal'));
else
uiwait(msgbox('file doesnt exist','modal'));
end
%-----------------------------------------------------------
% Shapefile read for country boundries --------------------
% border=shaperead([f,'\IND_adm0.shp']); % Reads the shape file of borders of india. states=shaperead([f,'\IND_adm1.shp']); % Reads the states of india.
JK=shaperead([f,'\india_state.shp']); % Reads the states of india. %------------------------------------------------------------
% Loop to show country boundries to overwrite on sm map-----------------
for i=1:14 geoshow(states(i,1).Y, states(i,1).X,'Color', 'blue','LineWidth',2); % reads the 35*1 matrics of IND_adm1.shp end for i=16:35 geoshow(states(i,1).Y, states(i,1).X,'Color', 'blue','LineWidth',2); % reads the 35*1 matrics of IND_adm1.shp end for i=1:35 geoshow(JK(i,1).Y,JK(i,1).X,'Color', 'blue','LineWidth',2); % reads the 35*1 matrics of IND_adm1.shp end %-------------------------------------------------------
and Here is the log file generated during deployment...
ant:<br><ant><br> <mkdir dir="C:\Users\ICRS\Desktop\map\distrib" /><br> <mkdir dir="C:\Users\ICRS\Desktop\map\src" /><br></ant> mcc -o map -W WinMain:map -T link:exe -d C:\Users\ICRS\Desktop\map\src -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -v C:\Users\ICRS\Desktop\package\start.m -a C:\Users\ICRS\Desktop\package\database -a C:\Users\ICRS\Desktop\package\function -a C:\Users\ICRS\Desktop\package\gui -a C:\Users\ICRS\Desktop\package\help -a C:\Users\ICRS\Desktop\package\image -a C:\Users\ICRS\Desktop\package\shapefile Compiler version: 4.15 (R2011a) Processing C:\Program Files\MATLAB\R2011a\toolbox\matlab\mcc.enc Processing C:\Program Files\MATLAB\R2011a\toolbox\map\mcc.enc Processing C:\Program Files\MATLAB\R2011a\toolbox\stats\mcc.enc Processing C:\Users\ICRS\Desktop\package\gui\HRSM_Calculation.fig Processing C:\Users\ICRS\Desktop\package\gui\HRSM_Mapping.fig Processing C:\Users\ICRS\Desktop\package\gui\HRSM_Mapping_Successful.fig Processing C:\Program Files\MATLAB\R2011a\toolbox\images\mcc.enc Processing C:\Users\ICRS\Desktop\package\gui\LST_Gen.fig Processing C:\Users\ICRS\Desktop\package\gui\Login_page.fig Processing C:\Users\ICRS\Desktop\package\gui\Operation_Successful.fig Processing C:\Users\ICRS\Desktop\package\gui\Pre_Processing_Module.fig Processing C:\Users\ICRS\Desktop\package\gui\Pre_Processing_Operation_Successful.fig Processing C:\Users\ICRS\Desktop\package\gui\SDS_Generation.fig Processing C:\Users\ICRS\Desktop\package\gui\Soil_Moisture_Mapping_Package.fig Processing C:\Program Files\MATLAB\R2011a\toolbox\finance\mcc.enc Processing C:\Program Files\MATLAB\R2011a\toolbox\shared\maputils\mcc.enc Processing C:\Program Files\MATLAB\R2011a\toolbox\shared\mapgeodesy\mcc.enc Processing C:\Program Files\MATLAB\R2011a\toolbox\shared\imageslib\mcc.enc Processing C:\Program Files\MATLAB\R2011a\toolbox\matlab\guide\guideopts.fig Processing C:\Program Files\MATLAB\R2011a\toolbox\matlab\winfun\actxcontrolselect.fig Processing C:\Program Files\MATLAB\R2011a\toolbox\matlab\winfun\actxcontrolcreateproperty.fig Processing include files... 2 item(s) added. Processing directories installed with MCR... The file C:\Users\ICRS\Desktop\map\src\mccExcludedFiles.log contains a list of functions excluded from the CTF archive. 2 item(s) added. Generating MATLAB path for the compiled application... Created 60 path items. Begin validation of MEX files: Wed Jul 17 11:41:27 2013 Validating 'C:\Program Files\MATLAB\R2011a\toolbox\compiler\componentinfo.mexw64'. Found MATLAB file 'C:\Program Files\MATLAB\R2011a\toolbox\compiler\componentinfo.m'. MEX file 'C:\Program Files\MATLAB\R2011a\toolbox\compiler\componentinfo.mexw64' is valid. It contains 'mexFunction.' Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptformats\private\bitparse.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptformats\private\dicom_decode_rle_segment.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptformats\private\dicomlookup_helper.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptformats\private\dicomparse.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptformats\private\rnitfc.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptformats\private\tobits.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptutils\iptcheckinput.mexw64'. Found MATLAB file 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptutils\iptcheckinput.m'. MEX file 'C:\Program Files\MATLAB\R2011a\toolbox\images\iptutils\iptcheckinput.mexw64' is valid. It contains 'mexFunction.' Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\map\private\checkinput_mex.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\map\private\gpcmex.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\map\private\ind2rgb8c.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\mapdisp\private\checkinput_mex.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\mapformats\private\checkinput_mex.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\mapformats\private\gtifinfo.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\map\mapformats\private\sdtsmex.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\DNToMatrix.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\MatrixToDN.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\computeDN.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\convertToDouble.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\matrixBitXor.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\sobolIndexed.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\sobolNet.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\sobolPoint.mexw64'. No conflicting MATLAB file found. Validating 'C:\Program Files\MATLAB\R2011a\toolbox\stats\stats\@sobolset\private\sobolSequence.mexw64'. No conflicting MATLAB file found. End validation of MEX files: Wed Jul 17 11:41:27 2013 Parsing file "C:\Users\ICRS\Desktop\package\start.m" (Referenced from: "Compiler Command Line"). Parsing file "C:\Program Files\MATLAB\R2011a\toolbox\compiler\deploy\deployprint.m" (Referenced from: "Compiler Command Line"). Parsing file "C:\Program Files\MATLAB\R2011a\toolbox\compiler\deploy\printdlg.m" (Referenced from: "Compiler Command Line"). Deleting 24 temporary MEX authorization files. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_19068_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_4833_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_8292_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_27120_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_1151_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_9965_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_8773_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_7553_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_25710_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_9337_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_10709_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_32116_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_31473_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_28446_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_2972_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_21521_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_21728_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_20029_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_29819_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_10314_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_3280_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_16283_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_7254_5444.auth'. Removing: 'C:\Users\ICRS\AppData\Local\Temp\mathworks_tmp_5444_22533_5444.auth'. Generating file "C:\Users\ICRS\Desktop\map\src\readme.txt". copy 'C:\Users\ICRS\Desktop\map\src\readme.txt' 'C:\Users\ICRS\Desktop\map\distrib\readme.txt' copy 'C:\Users\ICRS\Desktop\map\src\map.exe' 'C:\Users\ICRS\Desktop\map\distrib\map.exe'
Sorry to bother you again but it would be so kind of you if you would help me out in this regard. Thanks in advance.
Friedrich
Friedrich le 17 Juil 2013
what error do you get when running the generated exe?
rahul
rahul le 17 Juil 2013
I am getting no error Friedrich but the moment when shapefiles supposed to work, it does not work and the application seems to be paused up. I am also using geoshow function is that creating any problem?
Friedrich
Friedrich le 17 Juil 2013
Mhh, can you narrow down the line where it hangs or stops? (add some disp commands) Please compile it as console application and run it from a DOS prompt/shell in order to see any warning/error which might be thrown.
rahul
rahul le 17 Juil 2013
Thanks friedrich and Image analyst. It worked now since i added the path for landareas.shp, earlier it was not included.
Thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Compiler SDK dans Centre d'aide 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