Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: File names from char array?
Date: Thu, 24 Sep 2009 03:07:18 +0000 (UTC)
Organization: University of Memphis
Lines: 23
Message-ID: <h9enp6$qip$1@fred.mathworks.com>
References: <h9ejfs$i1h$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1253761638 27225 172.30.248.37 (24 Sep 2009 03:07:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 24 Sep 2009 03:07:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 233092
Xref: news.mathworks.com comp.soft-sys.matlab:572486


"Michael LaVigne" <mal209@lehigh.edu> wrote in message <h9ejfs$i1h$1@fred.mathworks.com>...
> 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.

fopen(fname{1},'wt')