DADiSP Worksheet Functions > Function Categories > Table Manipulation > UNRAVEL
Create a single vector from the columns of a table.
UNRAVEL(a)
a |
- |
An array. |
A series.
W1: rand(10, 3)
W2: unravel(w1)
W1 contains a 10x3 array of random values. W2 contains a single 30 point series that is constructed by appending the rows of W1.
If W1 contains a 3 by 3 table, this expression returns a series with 9 observations; the elements of column 1 of W1, followed by the elements of column 2 of W1, followed by the elements of the last column of W1.
a = {{1, 2, 3},
{4, 5, 6},
{7, 8, 9}};
b = unravel(a);
b == {1, 2, 3, 4, 5, 6, 7, 8, 9}
Variable a is a 3X3 array. Variable b is a 9x1 series constructed by appending the rows of a.
The A[..] syntax is equivalent to unravel(A). For example:
a = rand(10);
b = unravel(a);
c = a[..];
b == c