Splitting vector into shorter vectors of unequal lengths without using a loop?

10 views (last 30 days)
How is it possible to split the vector [a b c d e f h i j k] into e.g. three vectors [a b], [c d e f], [g h i j k] which have unequal lengths? I prefer to avoid using a loop in this case.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 28 Apr 2016
a=1:10
out=mat2cell(a,1,[2 4 4])

Categories

Find more on Just for fun in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!