Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!m3g2000pri.googlegroups.com!not-for-mail
From: Nathan <ngreco32@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: xlswrite
Date: Fri, 16 Oct 2009 09:58:37 -0700 (PDT)
Organization: http://groups.google.com
Lines: 33
Message-ID: <7a1ec1d4-02eb-4504-ba86-a10b62b14976@m3g2000pri.googlegroups.com>
References: <hb6s4f$evt$1@fred.mathworks.com> <hb7104$dus$1@fred.mathworks.com> 
	<ab7ac5a4-ce85-4e7d-8da5-b77e9c30f4db@k17g2000yqb.googlegroups.com> 
	<hba6pg$cah$1@fred.mathworks.com>
NNTP-Posting-Host: 198.206.219.33
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1255712317 14841 127.0.0.1 (16 Oct 2009 16:58:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 16 Oct 2009 16:58:37 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: m3g2000pri.googlegroups.com; posting-host=198.206.219.33; 
	posting-account=_KeVcAoAAAB7j3xn35ujaQ0BoQhuzwJP
User-Agent: G2/1.0
X-HTTP-Via: 1.1 wwwproxy-son-ca-01.ca.sandia.gov:80 (squid/2.5.STABLE14)
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) 
	Gecko/20090824 Firefox/3.5.3,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:577900


On Oct 16, 9:25 am, "ragab Rabeiy" <r_rab...@yahoo.com> wrote:
> > Did you look at the documentation for xlswrite()?
> > The worksheet name is one of the optional arguments.
> > Just use sprintf() to create whatever name you want, and pass it in.
> > Regards,
> > ImageAnalyst
>
> Hello ImageAnalyst,
>
> I don not ask about the worksheet name, please read my message again.
>
> The following code gave me 50 files, each one has its iteration value. But I need all the results to be in a unique file (in one exile file). also your code gave me 3 files, and i want only one file.
> note the follwing code:
>
> folder ='D:\work';
> for n=1:50;
>     File=sprintf('Test%d.xls',n);
>     if~exist(folder,'dir'); mkdir(folder); end
>     m=n*pi;
>     fileName=fullfile(folder,File);
>     xlswrite(fileName,m);
> end
>
> I hope that it not boring for you.
> Ragab

how about within your loop you specify the cells you want to be
written to?

xlswrite(filename,m,sprintf('A%d',n))
%will write output to cell An, where n is your counter