Note that there are not only numbers in that string, it also contains 'S' characters apparently at random, e,g.:
3 -118 S 623 1623 -71
One simple and efficient solution is to remove those 'S' characters before using sscanf:
v = sscanf(strrep(f,'S',''),'%d');
This correctly returns all 4297 numbers in the string, and can be easily adapted (e.g. using regexprep to remove specific types of characters, e.g. if it is possible that other alphabetic characters might occur in the string).
The simplest and most efficient solution by far is this:
v = sscanf(f,'%d%*[S ]');
Nothing will beat that simple command in terms of simplicity or speed.