Unequal partitioning a vector

I want to partitioning a vector to a certain number of vectors, but these vectors should be unequal in length, for example, if I have x = ([1 0 2 1 4 8 7 5 3 1 0 2]); and I'd divide it into 3 parts (vectors). The solution will be ([1 0 2]), ([1 4 8 7]) and ([the remaining]).

 採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 12 月 22 日

1 投票

out = mat2cell(x,1,[3 4 5])

1 件のコメント

Abe
Abe 2014 年 12 月 24 日
It looks working, but not exactly what I am trying to do, I have a long string of binary numbers and I want to partition this string to unequal parts based on rate I can form it by any equation. For example: 01| 0110 | 1000111 | 1011101110111001 | and so on.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Types についてさらに検索

製品

質問済み:

Abe
2014 年 12 月 22 日

コメント済み:

Abe
2014 年 12 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by