function SS = shuff2(x,y) % treat x as delimiters in y n = length(x)+1; m = length(y); vecs = generate_combs_vec(n,m); SS = {}; for i=1:size(vecs,1) SS{i} = vec2str(vecs(i,:),x,y); end SS = unique(SS); return function str = vec2str(vec,x,y) x(end+1) = '@'; str = ''; i1 = 1; for i=1:length(x) i2 = i1+vec(i); str = [str y(i1:i2-1) x(i)]; i1 = i2; end str = str(1:end-1); return