I wrote the following code to sum all number after locating numeric values from a string by using regexp.
s='2 groupd 40cell f'g =regexp(s,'\d*','match')g = cell2mat(g)
It gives an incorrect result: 240 –> instead of [2 40]
cellcell arrayMATLABstringstrings
s='2 groupd 40cell f'g =regexp(s,'\d*','match')g = cell2mat(g)
Best Answer