MATLAB: String tokenizer, string split

myStr = 'one_two_three';
pieces = regexp(myStr , '_', 'split')

%Output would be an pieces array with 3 elements.
pieces =

    'one'    'two'    'three'

No comments:

Post a Comment

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...