Problem 967. Split a string into chunks of specified length
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
		goc3
    	on 12 Dec 2016
	
	
  	Additional test cases have been added.
		Paresh yeole
    	on 22 Jan 2020
	
	
  	Problem Description says, function should return n*1, however the solutions are 1*n. Kindly, edit the problem description.
		Yunpeng Teng
    	on 5 Dec 2020
	
	
  	Problem say cell is n*1 ,but example is 1*n
Solution Comments
Show commentsProblem Recent Solvers1962
Suggested Problems
- 
         Remove the small words from a list of words. 1544 Solvers 
- 
         Find the largest value in the 3D matrix 1608 Solvers 
- 
         Create an n-by-n null matrix and fill with ones certain positions 668 Solvers 
- 
         
         683 Solvers 
- 
         Convert from Fahrenheit to Celsius 26814 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!