help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: batch processing


From: Josh Wiebe
Subject: Re: batch processing
Date: Mon, 2 Jan 2012 10:57:08 -0500

With batch processing, I find it useful to create a "list" file from the 
command prompt (Windows) or terminal (Unix), and then read in the "list" file 
in Octave.  This allows me to easily modify the list of files to suit my needs. 
 This can be done using: 
 dir /b *.csv > list.txt   in windows or,
ls  *.csv > list.txt   in unix.

Then in Octave,

fidList=fopen('list.txt', 'rt');
while ~feof(fidList)
        fileIn=fgetl(fidList);
        .
        .
        .
end %while
fclose(fidList)

Cheers,
Josh


>> 
>> 
>> I have a batch of .csv files in a folder. 
>> How can I program to get my script process every .csv on after the other?
>> 
>> Thank you,
>> 
>> Jerome
> 
> You can obtain the names of the files by ....
> 
>       files = {dir("*.csv").name};
> 
> ... and then you can use a for-loop to process them.
> 
>       for n = 1:numel(files)
>               csvfile = files{n};
>               .
>               .
>               .
>       endfor
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]