f = @(s,a)mat2cell(s(1:sum(a)),1,a) f('abcdefghijk', [2, 1, 3])f('Code Golf', [4, 1])f('Ayyy', [3])f('lexicographically', [2, 2, 2, 7, 4])
Standard input is empty
f = @(s, a) mat2cell (s (1:sum (a)), 1, a) ans = { [1,1] = ab [1,2] = c [1,3] = def } ans = { [1,1] = Code [1,2] = } ans = { [1,1] = Ayy } ans = { [1,1] = le [1,2] = xi [1,3] = co [1,4] = graphic [1,5] = ally }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!