what is command for circularly writing a row matrix in matlab

1 view (last 30 days)
example: let
a=[1 2 3 4 5]
i want output like
b=[ 1 2 3 4 5;
5 1 2 3 4;
4 5 1 2 3;
3 4 5 1 2;
2 3 4 5 1]
please help me

Accepted Answer

Walter Roberson
Walter Roberson on 2 Sep 2015
toeplitz() ?
  3 Comments
Satishkumar D
Satishkumar D on 2 Sep 2015
i just tried.. output is getting like below
1 2 3 4
2 1 2 3
3 2 1 2
4 3 2 1
if a=[1 2 3 4 5] but i want output
[ 1 2 3 4 5; 5 1 2 3 4; 4 5 1 2 3; 3 4 5 1 2; 2 3 4 5 1]

Sign in to comment.

More Answers (1)

Steven Lord
Steven Lord on 2 Sep 2015
gallery('circul', 1:5)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!