this functions retrives variable Values Variables is a structure array of structures Variables struct('Indx',{[indx],... @(ring,varval)fun(ring,varval,...),... },... 'Parameter',{{'paramname',{M,N,...},...},... [initialvarval],... },... 'LowLim',{[val],[val],...},... 'HighLim',{[val],[val],...},... )
0001 function CurrentVal=atGetVariableValue(ring,Variables) 0002 % 0003 % this functions retrives variable Values 0004 % 0005 % Variables is a structure array of structures 0006 % 0007 % 0008 % Variables struct('Indx',{[indx],... 0009 % @(ring,varval)fun(ring,varval,...),... 0010 % },... 0011 % 'Parameter',{{'paramname',{M,N,...},...},... 0012 % [initialvarval],... 0013 % },... 0014 % 'LowLim',{[val],[val],...},... 0015 % 'HighLim',{[val],[val],...},... 0016 % ) 0017 % 0018 0019 % history of changes 0020 % created 25-8-2012 0021 % updated 03-3-2012 to take in account of macro variables! 0022 % updated 25-3-2013 Indx and Parameter switched in case of function. 0023 % getfield(...Parameter{:}) instead of Parameter{1} or{2} 0024 0025 0026 CurrentVal=arrayfun(@getval,Variables,'UniformOutput',false); 0027 0028 function value=getval(v) 0029 if isa(v.Indx,'function_handle') 0030 value=v.Parameter; 0031 else 0032 value=getfield(ring{v.Indx(1)},v.Parameter{:}); 0033 % value=mean(cellfun(@(elem) getfield(elem,v.Parameter{:}),ring(v.Indx))); 0034 end 0035 end 0036 0037 end