Unequal partitioning a vector

3 visualizzazioni (ultimi 30 giorni)
Abe
Abe il 22 Dic 2014
Commentato: Abe il 24 Dic 2014
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]).

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 22 Dic 2014
out = mat2cell(x,1,[3 4 5])
  1 Commento
Abe
Abe il 24 Dic 2014
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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Data Types in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by