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
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers2124
Suggested Problems
-
Extract leading non-zero digit
2251 Solvers
-
How to find the position of an element in a vector without using the find function
2816 Solvers
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1322 Solvers
-
Get the elements of diagonal and antidiagonal for any m-by-n matrix
518 Solvers
-
1598 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Additional test cases have been added.
Problem Description says, function should return n*1, however the solutions are 1*n. Kindly, edit the problem description.
Problem say cell is n*1 ,but example is 1*n