MATLAB: Find string and get number from a Cell array of strings.

cell arrayMATLABstrings

Hey All
I have a Cell array of strings, were i need to find string 'L/12'. I know i can use:
idx = strfind(Str,'L/'); %To find my string
But how can i get the number out of the string after i found the string in my cell array?

Best Answer

c = {'a string with L/50 to find';
'another with nothing to find';
'and another with L/12 to find'};
number = regexp(c, '(?<=L/)\d+', 'match', 'once')
will extract the number (integer only) after the L/ in each string of the cell array.