www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@cset_ccd/designproperties.m
function p = designproperties(c,p,m) %DESIGNPROPERTIES properties for command-line % % p = designproperties(c,p) % Copyright 2007 The MathWorks, Inc. CLSID = mfilename('class'); [p,OK] = PersistentStore(p,CLSID); if ~OK p = iMakeProps(c,p,m); PersistentStore(p,CLSID); end function p = iMakeProps(c,p,m) p = designproperties(c.candidateset,p,m); p = addprop(p,'NumberOfCenterPoints',... @iGetCenterPoints, @iSetCenterPoints,... 'int',[0 Inf],... 'Number of center points'); p = addprop(p,'StarPoints',... @iGetStarPoints, @iSetStarPoints,... 'enum',{'FaceCenteredCube', 'Spherical', 'Rotatable', 'Custom'},... 'Star point position'); p = addprop(p,'Inscribe',... @iGetInscribe, @iSetInscribe,... 'boolean',[],... 'Inscribe points'); p = addprop(p,'Alpha',... @iGetAlpha, @iSetAlpha,... 'vector',{'positive',nfactors(m)},... 'Star point location'); function v = iGetCenterPoints(c,m) v = c.Nc; function c = iSetCenterPoints(c,v,m) c.Nc = v; function v = iGetStarPoints(c,m) a = get(c,'alpha'); nf = nfactors(m); if all(a==1) v = 'FaceCenteredCube'; elseif all(abs(a-sqrt(nf))<1e-10) v = 'Spherical'; elseif all(abs(a-(2^(nf/4)))<1e-10) v = 'Rotatable'; else v = 'Custom'; end function c = iSetStarPoints(c,v,m) a = get(c,'alpha'); nf = nfactors(m); switch v case 'FaceCenteredCube' val = 1; case 'Spherical' val = sqrt(nf); case 'Rotatable' val = 2^(nf/4); otherwise val = 0.5; end a(:) = val; c = set(c,'alpha',a); function v = iGetInscribe(c,m) v = logical(c.inscribe); function c = iSetInscribe(c,v,m) c.inscribe = v; function v = iGetAlpha(c,m) v= get(c,'alpha'); function c = iSetAlpha(c,v,m) c = set(c,'alpha',v);