output maggroups in r with indexes between GS and GE markers. maggroups is a cell array of magnet indexes describing a single magnet in reality, but sliced in the lattice a single magnet has the same MagNum value. see also: UniformGirderErrors
0001 function maggroups=getMagGroupsFromGirderIndex(r) 0002 % 0003 % output maggroups in r with indexes between GS and GE markers. 0004 % 0005 % maggroups is a cell array of magnet indexes describing a single magnet in 0006 % reality, but sliced in the lattice 0007 % a single magnet has the same MagNum value. 0008 % 0009 %see also: UniformGirderErrors 0010 0011 indGS=find(atgetcells(r,'FamName','GS')); 0012 indGE=find(atgetcells(r,'FamName','GE')); 0013 0014 maggroups=arrayfun(@(a,b)makegroup(a,b),indGS,indGE,'un',0); 0015 0016 return 0017 0018 function g=makegroup(a,b) 0019 g=a:1:b; 0020 return