Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Extra characters leftover at the end should be dropped. Example:

break_string('I seem to be having tremendous difficulty with my lifestyle',[4 1 5 22])

should return a 4x1 cell array:

ans = 
  'I se'    'e'    'm to '    'be having tremendous d'

Solution Stats

5119 Solutions

2051 Solvers

Last Solution submitted on Feb 02, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Group


Problem Recent Solvers2051

Problem Tags

Community Treasure Hunt

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

Start Hunting!