Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Forming a new matrix by taking particular elements of an existing matrix
Date: Sun, 25 Dec 2011 00:45:10 +0000 (UTC)
Organization: Xoran Technologies
Lines: 20
Message-ID: <jd5rmm$o6m$1@newscl01ah.mathworks.com>
References: <jd1o90$flt$1@newscl01ah.mathworks.com> <jd2joc$3uf$1@newscl01ah.mathworks.com> <jd2uos$52o$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1324773910 24790 172.30.248.46 (25 Dec 2011 00:45:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 25 Dec 2011 00:45:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:753119

"Kenan" wrote in message <jd2uos$52o$1@newscl01ah.mathworks.com>...
>
> >   Based on your statement "start from the bottom left of the above matrix on" perhaps you mean the following.  With A your original matrix:
> > 
> >   B = reshape(flipud(A).',[],1);
> >   B = B(B~=0);
> > 
> > Roger Stafford
> 
> Yes, that was what i meant exactly. Thank you again.
==============


But as a small point of optimization, note that

B=nonzeros(B)

is better (more memory-efficient) than

B = B(B~=0)