Thread Subject: run code on multiple xls files

Subject: run code on multiple xls files

From: A Ram

Date: 4 Oct, 2009 13:27:01

Message: 1 of 4

Hi,

I currently developed a code that takes in only 1 .xls file and runs an analysis. I was wondering if there is a simple way to change the code to take each .xls file in the current dir at a time, run the current code, and save the outputs for each analysis of the respective .xls file.

Thanks !

Subject: run code on multiple xls files

From: Rune Allnor

Date: 4 Oct, 2009 13:37:12

Message: 2 of 4

On 4 Okt, 15:27, "A Ram" <shal....@gmail.com> wrote:
> Hi,
>
> I currently developed a code that takes in only 1 .xls file and runs an analysis. I was wondering if there is a simple way to change the code to take each .xls file in the current dir at a time, run the current code, and save the outputs for each analysis of the respective .xls file.

Yes:

1) Refactor the present code such that it takes two arguments,
   the names of the input file and the output file
2) Write a loop that calls the '1-file code' and calls it
   with each of the input/output pairs of file names.

Rune

Subject: run code on multiple xls files

From: Brian Borchers

Date: 4 Oct, 2009 13:41:48

Message: 3 of 4

>
> 1) Refactor the present code such that it takes two arguments,
>    the names of the input file and the output file
> 2) Write a loop that calls the '1-file code' and calls it
>    with each of the input/output pairs of file names.
>
> Rune

The "dir" command would be useful in finding all of the .xls files in
the current directory.

Subject: run code on multiple xls files

From: ImageAnalyst

Date: 4 Oct, 2009 14:22:03

Message: 4 of 4

Section 4.12 of the FAQ may be useful here:
http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_process_a_sequence_of_files.3F

Alternate versions of xlswrite will speed things up:
http://www.mathworks.com/matlabcentral/fileexchange/?term=xlswrite1

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