Interpret string to form sequence of numbers
Show older comments
I want to see if something like this already has been discussed (so I am not reinventing the wheel). Basically, I will read in a string (from a GUI) that defines a sequence of numbers, where (as an example):
temp_str = '1,2,4-9,12-20(2)';
And then, after interpreting the contents of the string, the output to the code would yield a numeric array with values:
temp_seq = [1,2,4,5,6,7,8,9,12,14,16,18,20];
Has anyone come across a thread that discusses something similar to this? If so, let me know as I would like to clean up and make my version more efficient.
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings 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!