function inum=iles(text,nn)
% reads integer values out of string
% read the nn'th integer number which can be found
% in the string text and returns it. If not found returns NaN. 
% if nn is not given, assumes nn=1
if nargin==1; nn=1; end

inum=NaN;
ii=ismember(text,'0123456789');
ii=find(diff([0 ii])~=0);
if isempty(ii); return; end
ii=[ii length(text)+1];
if nn*2>length(ii); return; end
inum=str2num(text(ii(nn*2-1):ii(nn*2)-1));
