MATLAB: How to extract only numerical values from cell into new column array

breakcell arrays

For this data:
"chb12_06.edf"
"1665 seconds"
"1726 seconds"
"3415 seconds"
"3447 seconds"
"chb12_08.edf"
"1426 seconds"
"1439 seconds"
"1591 seconds"
"1614 seconds"
"1957 seconds"
"1977 seconds"
"2798 seconds"
"2824 seconds"
"chb12_09.edf"
"3082 seconds"
"3114 seconds"
"3503 seconds"
"3535 seconds"
"chb12_10.edf"
"593 seconds"
"625 seconds"
"811 seconds"
"856 seconds"
Whis is a column in a larger cell array. I want to extract just the seconds value after each edf file, and possibly put them in a new array or matrix, eg:
{"chb12_06.edf" "1665 seconds" "1726 seconds" "3415 seconds" "3447 seconds" ; "chb12_08.edf" "1426 seconds" "1439 seconds" "1591 seconds" "1614 seconds" "1957 seconds" "1977 seconds" "2798 seconds" "2824 seconds"...}
I hope this makes sense what I'm trying to achieve, if not please feel free to clarify, thanks!

Best Answer

s={"chb12_06.edf" "1665 seconds" "1726 seconds" "3415 seconds" "3447 seconds" "chb12_08.edf" "1426 seconds" "1439 seconds" "1591 seconds" "1614 seconds" "1957 seconds" "1977 seconds" "2798 seconds" "2824 seconds"};
sc = cellfun(@char,s,'Unif',0); %cast for regexp, which does not work on string input
sm = regexp(sc,'^\d* seconds','match');
[sm{:}]