I have a vector composed of 10 elements and I want to "split" it into two vectors composed of five elements:


but the output is a matrix...


How can I obtain 2 separated vectors rather than a matrix?

  • 2
    $\begingroup$ What are 'two separated vectors'? Sequence @@ Partition[q,5]? It will still have Sequence head but that is the closest concept I suppose. $\endgroup$
    – Kuba
    Jun 22, 2017 at 15:10
  • $\begingroup$ @tomd: Huh? Doesn't your answer give precisely what the poser's (unsatisfactory) answer gives? $\endgroup$ Jun 22, 2017 at 16:05
  • $\begingroup$ Don't think of it as a matrix, think of it as a list of vectors. You can do [[1]] or //First or any other list operation to extract the first and second vectors. $\endgroup$
    – 1110101001
    Jun 22, 2017 at 19:45

2 Answers 2


The output of a line of Mathematica code is a single element, so


is all you can get. If you want to access the parts individually:




What exactly do you want this for? (That will help us help you.)


How about:

q = {1,2,3,4,5,6,7,8,9,10};
{part1, part2} = Partition[q,5]

Now you have two separate lists (part1 and part2), each containing half of the partitioned q.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.