MATLAB: Problem in displaying a substring

displaying substring

Problem in displaying a substring
Ex: I have this line:-
C:\abc\xyz\myName_1.wav
I want to display only 'myName' from this line

Best Answer

Dear.. there can be multiple way. The easy way I think is to parse the string by dividing into tokens. Here is example you requested. lets say your string is in variable a;
a ='C:\abc\xyz\myName_1.wav';
strtok(fliplr(strtok(fliplr(strtok(a,'.')),'\')),'_')