0001 function [newring,refpts] = atsbreak(ring,sdata)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 mk=atmarker('xyzt');
0015 selem=findspos(ring,1:length(ring)+1);
0016 [sv,isort]=sort(mod(sdata(:)',selem(end)));
0017 ir=1;
0018 is=1;
0019 it=0;
0020 nr={};
0021 for ie=1:length(ring)
0022 if selem(ie+1) > sv(is)
0023 elem=ring{ie};
0024 for j=is:length(sv)
0025 if selem(ie+1) <= sv(j)
0026 last=j-1;
0027 break
0028 end
0029 last=j;
0030 end
0031 frac=(sv(is:last)-selem(ie))./elem.Length;
0032 is=last+1;
0033 it=it+1;
0034 nr{it}=[ring(ir:ie-1);atsplitelem(elem,frac,mk)];
0035 ir=ie+1;
0036 if is > length(sv), break; end
0037 end
0038 end
0039 newring=cat(1,nr{:},ring(ir:end));
0040 refpts(isort)=find(atgetcells(newring,'FamName','xyzt'));
0041 refpts=reshape(refpts,size(sdata));
0042 end