Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!news.glorb.com!news2.glorb.com!postnews.google.com!k13g2000prh.googlegroups.com!not-for-mail
From: jrenfree <jrenfree@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Basic Matlab Question
Date: Mon, 16 Nov 2009 15:59:29 -0800 (PST)
Organization: http://groups.google.com
Lines: 28
Message-ID: <31a529da-12b1-4550-b121-4cb2251d2ec9@k13g2000prh.googlegroups.com>
References: <hdso7p$sh5$1@fred.mathworks.com>
NNTP-Posting-Host: 137.110.142.170
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1258415969 20586 127.0.0.1 (16 Nov 2009 23:59:29 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 16 Nov 2009 23:59:29 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: k13g2000prh.googlegroups.com; posting-host=137.110.142.170; 
	posting-account=lVpOYAoAAAD2lyD71kM3JZW0H08VNtYu
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) 
	Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:585615


On Nov 16, 3:46 pm, "James Carter" <jim...@msn.com> wrote:
> I have a 32 x 1300 2D array, lets call it S.  I know I can pick off a particular row with the following argument: A = S(1,:); which gives me a 1 x 1300 array from the first
> row of the 2D array.  I want every row assigned to a new indexed array, so I would start off with
>
> for n = 1:rows
> A(n) = S(n,:);
> end
>
> This doesn't work because of a dimensional mismatch.   I'm not really trying to define
> a dimension but simply declare a unique identifier.   How am I able to assign rows
> such that I can put them in A(1), A(2), etc., all with the dimension 1 x 1300.  
>
> Thanks!

So essentially you want A to be a 32x1 vector?  You're trying to
access single elements of A, yet you're trying to put a 1x1300 length
vector into that single element.

You would either need to do A(n,:) = S(n, :) (which is pointless
because then A=S), or you need to make A either a structure or cell
array.  That would A could be a 32x1 cell array, where each cell is
then a 1x1300 vector.