Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!p15g2000vbl.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How does the MATLAB Compiler deal with .mat files?
Date: Tue, 28 Jul 2009 19:50:01 -0700 (PDT)
Organization: http://groups.google.com
Lines: 70
Message-ID: <dff54455-6cd6-4ee0-8490-af21fe5a68d6@p15g2000vbl.googlegroups.com>
References: <h23fod$8p2$1@fred.mathworks.com> <h23k1b$7rk$1@fred.mathworks.com> 
	<h4lmjt$4mh$1@fred.mathworks.com> <h4m3vd$jla$1@fred.mathworks.com> 
	<h4o4na$qbr$1@fred.mathworks.com>
NNTP-Posting-Host: 75.186.70.56
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1248835801 17542 127.0.0.1 (29 Jul 2009 02:50:01 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 29 Jul 2009 02:50:01 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: p15g2000vbl.googlegroups.com; posting-host=75.186.70.56; 
	posting-account=0rLUzAkAAABojYSRC64DkTbtiSCX77HH
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
	GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
	3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:559165


On Jul 28, 8:22 pm, "William" <w_kin...@yahoo.com> wrote:
> OK...that makes no sense to me either.  I will have to tell the installer where to put the .mat file.  Correct?  Therefore, when I use the mcc command to create the executable, I should then be able to put the required .mat file somewhere manually without using the installer.  Correct?  Where do I put it?  In which folder?  
>
> I have not found the appropriate location and ...
[snip].  

> Thanks,
> Billy

Billy:
You should probably put the mat file in the same folder as your
executable.  The trick is that unless you put a "cd somepath" in your
startup.m file when you compile it, it will most likely startup with
"my documents\MATLAB" as the current folder when you run your
executable and if you don't put the full path of your mat file, then
it will look there, which is most likely NOT where you installed your
executable in.  I suggest you play around with this code (the ShowPath
() function).  Also, look at the url (in the comment section) for a
discussion Bruno and others had to help explain it to you (it was
basically the same question you're having)

% Returns the path of the executable.
% http://groups.google.com/group/comp.soft-sys.matlab/browse_frm/thread/b326963a69020d8b/55ac59a943d
% ac841?hl=en&lnk=gst&q=current+directory+exe#55ac59a943dac841
% My test program gives the following output:
% pwd: C:\WINDOWS
% AppRootPath: C:\DOCUME~1\username\LOCALS~1\Temp\username
\mcrCache7.10\
% userpath: C:\Documents and Settings\username\My Documents\MATLAB;
% showpath: D:\Projects\testPath
%
%
% The test program was
% function testPath()
% % mcc -mv testPath
% disp(['pwd: ' pwd]);
% disp(['AppRootPath: ' AppRootPath()])
% disp(['userpath: ' userpath])
% disp(['showpath: ' showpath()]);
% input('Press return');
% end
function [thePath] = ShowPath()
	% Show EXE path:
	if isdeployed % Stand-alone mode.
		[status, result] = system('set PATH');
		thePath = char(regexpi(result, 'Path=(.*?);', 'tokens', 'once'));
	else % Running from MATLAB.
		[macroFolder, baseFileName, ext] = fileparts(mfilename('fullpath'));
		thePath = macroFolder;
% 		thePath = pwd;
	end
	return ;

William:
Use the above code to construct the full path of your mat file, which
(like I said) I'd recommend putting in the same folder as your
executable.  It works for me.  But after that, you'll still have to
distribute your mat file with your executable and any other run-time
files that are needed that can't be built into the executable, such as
documentation, help files, sample data files, splash images, etc.  I
use the Wise installer to bundle all these up into a single
installation file, but you can use whatever installation package you
want.
Good luck,
ImageAnalyst