help-octave
[Top][All Lists]
Advanced

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

Re: processing filenames returned by glob


From: Ether Jones
Subject: Re: processing filenames returned by glob
Date: Wed, 3 May 2017 13:21:34 -0400



On Wed, May 3, 2017 at 12:39 PM, Nicholas Jankowski <address@hidden> wrote:
On Wed, May 3, 2017 at 12:25 PM, Ether Jones <address@hidden> wrote:
>
> Hello.
>
> I used glob to return a cell array of filenames.
>
> Now I want Octave to load and process each of those filenames, one at a time, and generate a separate output file for each input file.
>
> Can someone please point me in the right direction?
>
> Or is there a better way to do this?
>

ok, so you have a list of filenames. Are these m-file scripts? data files you want to load and process in some way? .mat files that will bring in a bunch of variables when loaded? ...?

your filenames are strings, so there are a bunch of ways you could use a for loop appending that filename string to some other command like load, fopen, dlmread, etc.  See:

https://www.gnu.org/software/octave/doc/v4.2.1/Simple-File-I_002fO.html

You can do a similar thing for file output once you have done whatever needs to be done. In you're loop you'll want to save data, where the save-as filename will somehow reflect the unique aspect of what was done, be it just appending the input filename, or something.

More specifics might produce more specific advice :)

Nick J.

​The filenames I fetched into a cell array using glob are data files in CSV format.  I want to run an Octave function separately on each of those data files (to process the data)​
 
​ ​and produce a separate output report file for each data file.

I know how to load a CSV file and process it with Octave.  What I don't know (and am asking for help - ideally an example code snippet) is how to extract the filenames from the cell array that glob created so that I can load and process them one at a time.

Thank you.


reply via email to

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