Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Construct a matrix with rotational column elements
Date: Wed, 30 Nov 2011 02:41:08 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <jb4544$ha7$1@newscl01ah.mathworks.com>
References: <jb395o$haj$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1322620868 17735 172.30.248.45 (30 Nov 2011 02:41:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 30 Nov 2011 02:41:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:750888

"Wendy " <wlq121@gmail.com> wrote in message <jb395o$haj$1@newscl01ah.mathworks.com>...
> I want to construct a matrix with rotational column elements in each row. Following is an example
> 
>  A =
>      1     2     3     4
>      4     1     2     3
>      3     4     1     2
>      2     3     4     1
> 
> Given r = [1 2 3 4], instead of constructing the matrix row by row, is there any function in Matlab for doing this automatically?
- - - - - - - - 
  Also you could use:

 A = toeplitz(circ(r(end:-1:1),1),r);

Roger Stafford