Thread Subject: Using Compiled XLS File

Subject: Using Compiled XLS File

From: Brian

Date: 27 Oct, 2008 02:06:02

Message: 1 of 6

I have a MS Excel file that serves as a template for data reporting.

In my m-file, I create a new Excel file by copying the template with the COPYFILE command. The name of the new file varies by input. Following analysis, fields of the new file are populated with results. The process repeats several times.

Everything works beautifully from the command window within MATLAB.

When I compile my code to create a stand-alone application, I always include the template source file along with the m-file and it compiles without error. However, upon executing the stand-alone application, I receive an error at the COPYFILE command: it can not find the source file.

Please let me know if you have any suggestions to resolving this issue.

Subject: Using Compiled XLS File

From: Ashish Uthama

Date: 27 Oct, 2008 13:07:19

Message: 2 of 6

How are you specifying the template file path to the COPYFILE function?

I believe you should just addresss it by name since all included files in
the projec will be on the MATLAB path.


On Sun, 26 Oct 2008 22:06:02 -0400, Brian <ceo21mil@hotmail.com> wrote:

> I have a MS Excel file that serves as a template for data reporting.
>
> In my m-file, I create a new Excel file by copying the template with the
> COPYFILE command. The name of the new file varies by input. Following
> analysis, fields of the new file are populated with results. The
> process repeats several times.
>
> Everything works beautifully from the command window within MATLAB.
>
> When I compile my code to create a stand-alone application, I always
> include the template source file along with the m-file and it compiles
> without error. However, upon executing the stand-alone application, I
> receive an error at the COPYFILE command: it can not find the source
> file.
>
> Please let me know if you have any suggestions to resolving this issue.

Subject: Using Compiled XLS File

From: Peter Webb

Date: 27 Oct, 2008 14:25:49

Message: 3 of 6

If you can post the exact text of the error message, and the command that
generated it, we can probably offer more precise diagnostics.

"Brian " <ceo21mil@hotmail.com> wrote in message
news:ge37ma$7rk$1@fred.mathworks.com...
>I have a MS Excel file that serves as a template for data reporting.
>
> In my m-file, I create a new Excel file by copying the template with the
> COPYFILE command. The name of the new file varies by input. Following
> analysis, fields of the new file are populated with results. The process
> repeats several times.
>
> Everything works beautifully from the command window within MATLAB.
>
> When I compile my code to create a stand-alone application, I always
> include the template source file along with the m-file and it compiles
> without error. However, upon executing the stand-alone application, I
> receive an error at the COPYFILE command: it can not find the source file.
>
> Please let me know if you have any suggestions to resolving this issue.

Subject: Using Compiled XLS File

From: Brian

Date: 27 Oct, 2008 16:30:03

Message: 4 of 6

Thank you for the responses.

Below is the relevant portion of my code:

% Excel Summary File
directoryName = ['Lot ', lotSummary.LotID, '\'];
mkdir(directoryName);
fileName = ['Lot ', lotSummary.LotID, ' Summary.xls'];
copyfile('WTASummary.xls', [directoryName, fileName]);
cd(directoryName);

And the error message from the compiled stand alone application:

??? Error using ==> copyfile
No matching files were found.

MATLAB:COPYFILE:FileDoesNotExist

Best regards,
Brian

Subject: Using Compiled XLS File

From: Ashish Uthama

Date: 27 Oct, 2008 18:27:48

Message: 5 of 6

How do you include WTASummary.xls? The recommended approach is to place it
under 'Other files' in DEPLOYTOOL.

File under this section will be extracted to the CTF root directory, under
a subdirectory which has the same name as the project.
You should then use the CTFROOT function to build up the path to this
excel file. Something along the lines of:

copyfile(fullfile(ctfroot,'yourProjectName','WTASummary.xls'),
[directoryName, fileName]);

Also:
> directoryName = ['Lot ', lotSummary.LotID, '\'];
> mkdir(directoryName);
Note: this creates the dir in the 'current working directory'. This might
not be what you expect on a deployed application, ensure you CD to a
specific directory first or use absolute path names.


On Mon, 27 Oct 2008 12:30:03 -0400, Brian <ceo21mil@hotmail.com> wrote:

> Thank you for the responses.
>
> Below is the relevant portion of my code:
>
> % Excel Summary File
> directoryName = ['Lot ', lotSummary.LotID, '\'];
> mkdir(directoryName);
> fileName = ['Lot ', lotSummary.LotID, ' Summary.xls'];
> copyfile('WTASummary.xls', [directoryName, fileName]);
> cd(directoryName);
>
> And the error message from the compiled stand alone application:
>
> ??? Error using ==> copyfile
> No matching files were found.
>
> MATLAB:COPYFILE:FileDoesNotExist
>
> Best regards,
> Brian

Subject: Using Compiled XLS File

From: Brian

Date: 27 Oct, 2008 19:32:01

Message: 6 of 6

Thank you Ashish.

Your suggestion to use
> copyfile(fullfile(ctfroot,'yourProjectName','WTASummary.xls'),
> [directoryName, fileName]);
solved the problem.

In my program I also access another "Other file" - specifically a perl script - but without using ctfroot. It is interesting that it is necessary in one case but not the other.

Again, thank you for your help.

Best regards,
Brian

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
ctfroot Brian 27 Oct, 2008 15:35:05
compiler Brian 26 Oct, 2008 22:10:05
xls Brian 26 Oct, 2008 22:10:05
excel Brian 26 Oct, 2008 22:10:05
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