Rudi Angela
Rudi Angela

Reputation: 1473

How to turn a matrix of nested vectors into a vector of nested vectors

I am producing a matrix of pairs (= nested vectors) like so:

x←⍳10
y←⍳10
x∘.,y

But for further processing I need to have the pairs in one vector of pairs. If I apply ravel:

,/x∘.,y

then the pairs are not anymore nested. How to transform the matrix into a vector and retain the nested pairs?

Upvotes: 4

Views: 118

Answers (1)

Adám
Adám

Reputation: 7616

You just need to ravel the matrix:

,x∘.,y

This reshapes the matrix into a vector containing the same elements in ravel order.

Upvotes: 5

Related Questions