I want to how know to get certain numbers from a string in matlab. For example, I have a string:
‘ABCD_01 36_00 3 .txt’, (there is spacing between 01 and 36)
What I need is to get the number 36 and 3. How can I do it in matlab? I’ve tried finding the answer from previous posts but can not find one that fits this purpose. Thanks for the help.
If the filenames always start with four characters you can do:
>> filename = 'ABCD_01 36_00 3 .txt'; >> sscanf(filename, '%*4c_%*u %u_%*u %u.txt') ans = 36 3