Home > atmatch > atDisplayVariableChange.m

atDisplayVariableChange

PURPOSE ^

this functions retrives variable Values for two rings to compare

SYNOPSIS ^

function atDisplayVariableChange(ring1,ring2,Variables)

DESCRIPTION ^

 this functions retrives variable Values for two rings to compare

 Variables is a structure array

 Variables  struct('Indx',{[indx],...
                           @(ring,varval)fun(ring,varval,...),...
                          },...
                   'Parameter',{{'paramname',{M,N,...},...},...
                                [initialvarval],...
                               },...
                   'LowLim',{[val],[val],...},...
                   'HighLim',{[val],[val],...},...
                   )

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function atDisplayVariableChange(ring1,ring2,Variables)
0002 % this functions retrives variable Values for two rings to compare
0003 %
0004 % Variables is a structure array
0005 %
0006 % Variables  struct('Indx',{[indx],...
0007 %                           @(ring,varval)fun(ring,varval,...),...
0008 %                          },...
0009 %                   'Parameter',{{'paramname',{M,N,...},...},...
0010 %                                [initialvarval],...
0011 %                               },...
0012 %                   'LowLim',{[val],[val],...},...
0013 %                   'HighLim',{[val],[val],...},...
0014 %                   )
0015 %
0016 
0017 % history of changes
0018 % created 30-8-2012
0019 % updated 21-03-2012 Varaibles are structure array and not cell array of
0020 %                    structures
0021 %                   Indx and Parmaeter switched in case of function.
0022 %                   setfield(...Parameter{:}) instead of Parameter{1} or{2}
0023 
0024 disp('Final variable values:')
0025 disp('   ')
0026 disp('Name       field          before    after   variation')
0027 ok=arrayfun(@(v) dispv(v,ring1,ring2),Variables); %#ok<NASGU>
0028 disp('   ')
0029 disp('-----oooooo----oooooo----oooooo----')
0030 disp('   ')
0031 
0032     function ok=dispv(Variable,ring1,ring2)
0033         if isa(Variable.Indx,'function_handle')
0034             funcname=sprintf('%-20.20s',func2str(Variable.Indx));
0035             for i=1:length(Variable.Parameter)
0036                 fprintf('%-23.23s %8g    %8g    %8g\n',...
0037                     funcname,Variable.Parameter(i),0,0);
0038             end
0039         else
0040             ok=cellfun(@(elem1,elem2) dd(elem1,elem2,Variable.Parameter),...
0041                 ring1(Variable.Indx),ring2(Variable.Indx)); %#ok<NASGU>
0042         end
0043         ok=0;
0044     end
0045 
0046     function ok=dd(elem1,elem2,Parameter)
0047         value1 = getfield(elem1,Parameter{:});
0048         value2 = getfield(elem2,Parameter{:});
0049         fprintf('%-10.10s %-12.12s %8g    %8g    %8g\n',...
0050             elem1.FamName,Parameter{1},value1,value2,(value2-value1));
0051         ok=0;
0052     end
0053 end

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005