Path: news.mathworks.com!not-for-mail
From: "Michael LaVigne" <mal209@lehigh.edu>
Newsgroups: comp.soft-sys.matlab
Subject: File names from char array?
Date: Thu, 24 Sep 2009 01:54:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <h9ejfs$i1h$1@fred.mathworks.com>
Reply-To: "Michael LaVigne" <mal209@lehigh.edu>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1253757244 18481 172.30.248.37 (24 Sep 2009 01:54:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 24 Sep 2009 01:54:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2002516
Xref: news.mathworks.com comp.soft-sys.matlab:572476


Hi everyone,

I was wondering if anyone knew how to extract a filename from a character array?
I am currently modifying a program and have changed it to run multiple runs without user input (one additional external loop).

Now what i would like to do is input the filenames that i will be outputing to in an array:
fnameindex = ['609-1.txt'; ...
             '610-1.txt'; ...
             '611-5.txt'; ...
             '612-1.txt'; ...
             '617-4.txt'; ...
             '618-5.txt'];
    fname=cellstr(fnameindex);

but when i try and use the: '609-1.txt' as a filename in fopen(fname(1),'wt') it gets an error.

is there a better way to do this? or am i just going to have to type this in each required part of my program?

Thanks in advance,
Michael.