Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe08.iad.POSTED!7564ea0f!not-for-mail
From: "Nasser Abbasi" <nma@12000.org>
Newsgroups: comp.soft-sys.matlab
References: <hb6s4f$evt$1@fred.mathworks.com>
Subject: Re: xlswrite
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3598
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-EsetId: 321EA926BF2033386258
X-EsetScannerBuild: 5823
Message-ID: <pQEBm.2947$4E.1354@newsfe08.iad>
NNTP-Posting-Host: ncdeodfefpjopplmihjclpliaacepnnh
X-Complaints-To: abuse@charter.net
X-Trace: chhpdeimhjhhahnfadefjppgkgeilljaebedgiefhmmhkbcmncdeodfefpjopplmmgdmmdanmgdmojgmeldfjilndbmklmdhoeggmpchongebilpoijkkdiaplapdfohgemlcloahffblffb
NNTP-Posting-Date: Thu, 15 Oct 2009 12:46:13 UTC
Date: Thu, 15 Oct 2009 07:46:04 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:577515



"ragab Rabeiy" <r_rabeiy@yahoo.com> wrote in message 
news:hb6s4f$evt$1@fred.mathworks.com...
>i am a new user in Matlab, and i faced small problem, could u please help 
>me??
>
> this problem is: for the following code, Matlab writes only in Excel the 
> final value (pi*5),
>
> and I want it to write all the data from 1 to 5.
>
> for x=1:5;
> m=pi*x;
> xlswrite('file.xls', m)
> end


becuase each time in the loop, you are starting all over and writing to a 
new file.xls. The old file.xls is overwritten. there is no append by 
default.

As mentiod, no loop is neede, write the whole matrix data in one write. see 
help on how to make different sheets if you want.

--Nasser