You can use the regexp function in MATLAB with the pattern '[0-9,]+' to select only numbers and commas in a string. This will match any substring containing one or more digits or commas. Here's an example:
main.m75 chars3 lines
This will give you a cell array nums_and_commas containing:
main.m44 chars7 lines
Note: In the regular expression pattern, [0-9] matches any digit, and , matches any comma. The + sign means to match one or more of the preceding pattern (digits or commas). The 'match' option returns all the matching substrings as separate strings in a cell array.
gistlibby LogSnag