subsref

PURPOSE ^

SUBSREF - handle indexed references to model objects

SYNOPSIS ^

function result = subsref(md,index)

DESCRIPTION ^

SUBSREF - handle indexed references to model objects

   the first argument is the object and the second one a structure array
   Usage:
      result = subsref(md,index)
 
   See also SUBSASGN

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function result = subsref(md,index)
0002 %SUBSREF - handle indexed references to model objects
0003 %
0004 %   the first argument is the object and the second one a structure array
0005 %   Usage:
0006 %      result = subsref(md,index)
0007 %
0008 %   See also SUBSASGN
0009 
0010 if length(index)==1,
0011     index1=index(1);
0012     if(strcmp(index1.subs,'res')), displayresults(md);return; end
0013     if(strcmp(index1.subs,'solpar')), displaysolutionparameters(md);return; end
0014     if(strcmp(index1.subs,'bc')), displaybc(md);return; end
0015     if(strcmp(index1.subs,'mesh')), displaymesh(md);return; end
0016     if(strcmp(index1.subs,'par')), displayparameters(md);return; end
0017     if(strcmp(index1.subs,'parallel')), displayparallel(md);return; end
0018     if(strcmp(index1.subs,'control')), displaycontrol(md);return; end
0019     if(strcmp(index1.subs,'exppar')), displayexppar(md);return; end
0020     if(strcmp(index1.subs,'obs')), displayobservations(md);return; end
0021     if(strcmp(index1.subs,'mat')), displaymaterials(md);return; end
0022     if(strcmp(index1.subs,'qmu')), displayqmu(md);return; end
0023 
0024     if ~isempty(md.repository),
0025         %load variable needed, if necessary
0026         if exist(['.' md.repository '.' index1.subs],'file'),
0027             structure=load(['.' md.repository '.' index1.subs],'-mat');
0028             eval(['result=structure.' index1.subs ';']);
0029         else
0030             %the file does not exist, just return built in value
0031             result=builtin('subsref',md,index);
0032         end
0033     else
0034         %return built in value
0035         result=builtin('subsref',md,index);
0036     end
0037 else
0038     if ~isempty(md.repository),
0039         if exist(['.' md.repository '.' index(1).subs],'file'),
0040             %load variable needed
0041             variable=load(['.' md.repository '.' index(1).subs],'-mat');
0042         
0043             %use temporary structure.
0044             result=builtin('subsref',variable,index);
0045         else
0046             result=builtin('subsref',md,index);
0047         end
0048     else
0049         result=builtin('subsref',md,index);
0050     end
0051 end

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003