|
From: | Henk Borsje |
Subject: | Repeating and shifting a vector |
Date: | Thu, 5 Mar 2020 17:33:26 +0100 |
Is there a way to create a matrix from a vector, where each new row is either shifted or rotated one element, but if possible without a for-loop? A simple example: From A = [1 2 3 4 5 6 7 8 9 10] Create B = [1 2 3 4 5 6 7 8 9 10 ; 0 1 2 3 4 5 6 7 8 9; 0 0 1 2 3 4 5 6 7 8] This shows the last element dropping off, but a shift would be just as useful. Any ideas will be welcome. Henk Borsje |
[Prev in Thread] | Current Thread | [Next in Thread] |