Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!33g2000vbe.googlegroups.com!not-for-mail
From: arun <aragorn168b@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matrix names
Date: Sun, 30 Aug 2009 14:40:49 -0700 (PDT)
Organization: http://groups.google.com
Lines: 28
Message-ID: <dbefb905-0d5b-401a-a059-9fbe0d8ab92c@33g2000vbe.googlegroups.com>
References: <h7er8b$pjg$1@fred.mathworks.com>
NNTP-Posting-Host: 134.2.246.208
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1251668449 16600 127.0.0.1 (30 Aug 2009 21:40:49 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 30 Aug 2009 21:40:49 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: 33g2000vbe.googlegroups.com; posting-host=134.2.246.208; 
	posting-account=fyqXpgoAAABqt-0BifyaNxmZhzggFACu
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; 
	rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:567146


On Aug 30, 11:34 pm, "Nirmal " <nirmal_2...@yahoo.co.in> wrote:
> how to assign different names for matrices in a for loop..
>
> for ex
>
> if x=[1 2]
>
> if i want I1=[1 1]
>            I2= [1 2]
>
> for i=1:2
>      [what must be here??]=[1   x(i)];
> end;
>
> since i cant write Ii or I(i) m confused how to assign names in a for loop..
>
> thank u..

use a(i,:) to fill in the whole row with a vector and a(:,i) to fill a
column...

ex: a(1,:) = [1,2]; a(2,:) = [2,2];
if not, a(:,1) = [1;2]; a(:,2)= [2;2];

notice the ',' and ';' separators between row and column assignment
operations.
best, arun.