MATLAB: How to find an interger delimited by ‘) ‘ and ‘ (‘ in a text file

fscaftextscan

Hi guys,
I have a big text file (thousands of rows) in which every row has a different lenght. I need to extract from every row the integer placed between ')space' and 'space('.
An example of row is the following, I need the '9' visualized in the right of the fourth row ') 9 ('
19 190.114 147.458 147.5 14 (-24.5796,-7.37438,-147.5) (-7.47528,-26.538,157.5) (-18.2291,17.2516,-147.5) (-7.47528,-26.538,-147.5) (-25.5979,5.36551,-147.5) (14.1788,-21.535,157.5) (-18.2291,17.2516,157.5) (24.433,4.08327,-147.5) (-24.5796,-7.37438,157.5) (-25.5979,5.36551,157.5) (14.1788,-21.535,-147.5) (16.3404,14.1353,-147.5) (16.3404,14.1353,157.5) (24.433,4.08327,157.5) 9 (1,5,10,3) (1,8,9,6,12,13,5) (1,3,0,8) (2,11,12,6) (2,4,0,3,10,7,11) (2,6,9,4) (4,9,8,0) (5,13,7,10) (7,13,12,11) (0.22511,-0.974333,0) (0,-0,1) (-0.746054,-0.665885,0) (0.0897807,0.995962,-0) (-2.74537e-15,-2.45036e-15,-1) (-0.849921,0.52691,0) (-0.996821,-0.0796761,-0) (0.92839,-0.371606,0) (0.778939,0.6271,0)
Thanks for any help
Matteo

Best Answer

regexp(YourString, '(?<=\) )\d+(?= \()', 'match')