get maximal label in dir pre
0001 function mlab=getmaxlab(pre) 0002 % get maximal label in dir pre 0003 dn=[pre '/p*.mat'];c=dir(dn);mlab=0; 0004 for j=1:length(c) 0005 cn=c(j).name;lab=cn(2:length(cn)-4);lab=str2num(lab); 0006 if lab>mlab; mlab=lab; end 0007 end