MATLAB: Extreact Information from a String

MATLABstring

Hello, I do have the following Code
d = dir('/home/user/Documents/Data*.inp');
names = {d.name}
which gives me an Array of Strings.
names(1) is like = "Data_c11_t3.322111_id01111_Units.inp"
names(2) is like = "Data_c101_t4.32111_id01112_Units.inp"
etc.
Now I want to extract the time, which is in the name after "t". How can I extract the time in such a format?
Any suggestions?

Best Answer

regexp would be the best idea, I've no big experiences with it, I'll give it a shot anyway,
names = {'Data_c11_t3.322111_id01111_Units.inp';'Data_c101_t4.32111_id01112_Units.inp'};
t = regexp(names,'[0-9]+\.+[0-9*]+','match')