Path: news.mathworks.com!not-for-mail
From: "Michael LaVigne" <mal209@lehigh.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: File names from char array?
Date: Thu, 24 Sep 2009 03:19:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 30
Message-ID: <h9eof7$b33$1@fred.mathworks.com>
References: <h9ejfs$i1h$1@fred.mathworks.com> <h9enp6$qip$1@fred.mathworks.com>
Reply-To: "Michael LaVigne" <mal209@lehigh.edu>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1253762343 11363 172.30.248.35 (24 Sep 2009 03:19:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 24 Sep 2009 03:19:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2002516
Xref: news.mathworks.com comp.soft-sys.matlab:572488


Thanks for your reply... i figured this out right as i saw your responce... aparently the {} and () make all the difference with char's

Thanks again-
Michael.


"Godzilla " <godzilla@tokyo.edu> wrote in message <h9enp6$qip$1@fred.mathworks.com>...
> "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')