Interpret string to form sequence of numbers
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!