Thread Subject: Matlab Compiler and paths

Subject: Matlab Compiler and paths

From: Bill

Date: 1 Mar, 2009 18:40:19

Message: 1 of 6

All,

After some success as a "getting started" person with the Matlab Compiler I have run into a snag when trying a "real" project:

1. I did need to set some path values to get the top level script to execute properly, but indeed it does.

2. I have built and packaged the project many times now and it "almost" runs.

3. The problem is that an "exist(filename)" statement does not find the file when I run the ".exe" version of the project.

4. The file does exist and, as an experiment, I added some code to prepend the path to the filename, and sure enough the ".exe" version did find the file when doing the "exist"

5. Unfortunatley, there are several areas where the "m" code assumes that the Matlab path structure will supply the path to individual file names.


It is almost as though the whole set of Matlab paths does not get included with the MCR.

Any ideas?

TIA,

Bill

Subject: Matlab Compiler and paths

From: Bruno Luong

Date: 1 Mar, 2009 20:06:01

Message: 2 of 6

"Bill" <john.doe.nospam@mathworks.com> wrote in message <goekqj$m4m$1@fred.mathworks.com>...
> All,
>
> After some success as a "getting started" person with the Matlab Compiler I have run into a snag when trying a "real" project:
>
> 1. I did need to set some path values to get the top level script to execute properly, but indeed it does.
>
> 2. I have built and packaged the project many times now and it "almost" runs.
>
> 3. The problem is that an "exist(filename)" statement does not find the file when I run the ".exe" version of the project.
>
> 4. The file does exist and, as an experiment, I added some code to prepend the path to the filename, and sure enough the ".exe" version did find the file when doing the "exist"
>
> 5. Unfortunatley, there are several areas where the "m" code assumes that the Matlab path structure will supply the path to individual file names.
>
>
> It is almost as though the whole set of Matlab paths does not get included with the MCR.
>
> Any ideas?

I have read through your five comments and I do quite understand what in there!

Just one commen that might helpt: the default path when running an application in exe is the usually 2 level down from the location of the exe file. The folder is created to receive extracted encoded mfiles from the ctf.

When this is clear, you will be ready to fix any path issues after compilation.

It is also safer to use EXIST with second argument rather than single input.

Bruno

Subject: Matlab Compiler and paths

From: Ashish Uthama

Date: 2 Mar, 2009 14:21:07

Message: 3 of 6

On Sun, 01 Mar 2009 13:40:19 -0500, Bill <john.doe.nospam@mathworks.com>
wrote:

> All,
>
> After some success as a "getting started" person with the Matlab
> Compiler I have run into a snag when trying a "real" project:
>
> 1. I did need to set some path values to get the top level script to
> execute properly, but indeed it does.
>
> 2. I have built and packaged the project many times now and it "almost"
> runs.
>
> 3. The problem is that an "exist(filename)" statement does not find the
> file when I run the ".exe" version of the project.
>
> 4. The file does exist and, as an experiment, I added some code to
> prepend the path to the filename, and sure enough the ".exe" version did
> find the file when doing the "exist"
>
> 5. Unfortunatley, there are several areas where the "m" code assumes
> that the Matlab path structure will supply the path to individual file
> names.
>
>
> It is almost as though the whole set of Matlab paths does not get
> included with the MCR.
>
> Any ideas?
>
> TIA,
>
> Bill


Have you included the file ('filename' in exist(filename)) in the project?

Subject: Matlab Compiler and paths

From: Bill

Date: 4 Mar, 2009 15:32:02

Message: 4 of 6

Ashish,

The answer is NO. I'll bet that is the problem! I'll post a message if that is the case.

Thanks for the tip,

Bill

Subject: Matlab Compiler and paths

From: Emanuele

Date: 4 Mar, 2009 16:38:01

Message: 5 of 6

Hi Bill, i have a problem ti run the .exe file.

What is the right path to run the .exe file

I have tried with
matlabroot\bin\win32\file.exe
Is right??

Thanks all in advance

Emanuele

Subject: Matlab Compiler and paths

From: Bill

Date: 4 Mar, 2009 16:58:02

Message: 6 of 6

2 Things:

1. Ashish was correct, when I added all of the files that were referenced by the application, it ran correctly. A downside is that this added 16 Mbytes to my application size. This is what I want if I am deploying to a different computer, but not really what I want if those files already exist on my PC (or even the target PC). Oh well, all is OK for now.

2. Emanuele, you wrote the following:

"i have a problem ti run the .exe file. What is the right path to run the .exe file
I have tried with matlabroot\bin\win32\file.exe
Is right??"

Keeping in mind that I am a novice a this, as near as I can tell, the .exe file can be anywhere. In my case, I want it on a network drive, and it seemed to work fine from there for my application.

That being said, I would think there is some sort of "default pathing" that would permit the user to arrange the Matlab application .exe in the same folder as any data files and that those data files would be found on a "relative path" basis.

Bill

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com