How can i seperate a string in all possible smaller ones without using for loops;.
Show older comments
For example if my string is a='ATGCA' , i want to make b={'AT', 'TG', 'GC', 'CA'}.( the length of the smaller strings is random, it may be three or four in this example.)
Accepted Answer
More Answers (1)
Andrei Bobrov
on 23 Apr 2019
Edited: Andrei Bobrov
on 23 Apr 2019
0 votes
a = 'ATGCA';
out = cellstr(a((1:end-1)' + [0, 1]));
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!