Unequal partitioning a vector

조회 수: 1 (최근 30일)
Abe
Abe 2014년 12월 22일
댓글: Abe 2014년 12월 24일
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일
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개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by