/usr/share/freemat/toolbox/array/subsref.m is in freemat-data 4.0-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79  | % SUBSREF SUBSREF Overloaded Class Indexing
% 
% Usage
% 
% This method is called for expressions of the form
% 
%   c = a(b), c = a{b}, c = a.b
% 
% and overloading the subsref method allows you
% to define the meaning of these expressions for
% objects of class a.  These expressions are
% mapped to a call of the form
% 
%   b = subsref(a,s)
% 
% where s is a structure array with two fields. The
% first field is
%   -  type  is a string containing either '()' or
%  '{}' or '.' depending on the form of the call.
% 
%   -  subs is a cell array or string containing the
%  the subscript information.
% 
% When multiple indexing experssions are combined together
% such as b = a(5).foo{:}, the s array contains
% the following entries
% 
%   s(1).type = '()'  s(1).subs = {5}
%   s(2).type = '.'   s(2).subs = 'foo'
%   s(3).type = '{}'  s(3).subs = ':'
% 
% SUBSREF SUBSREF Array Dereferencing
% 
% Usage
% 
% This function can be used to index into basic array
% types (or structures).  It provides a functional interface
% to execute complex indexing expressions such as 
% a.b(3){5} at run time (i.e. while executing a script or
% a function) without resorting to using eval.  Note that
% this function should be overloaded for use with user defined
% classes, and that it cannot be overloaeded for base types.
% The basic syntax of the function is:
% 
%    b = subsref(a,s)
% 
% where s is a structure array with two fields. The
% first field is
%   -  type  is a string containing either '()' or
%  '{}' or '.' depending on the form of the call.
% 
%   -  subs is a cell array or string containing the
%  the subscript information.
% 
% When multiple indexing experssions are combined together
% such as b = a(5).foo{:}, the s array should contain
% the following entries
% 
%   s(1).type = '()'  s(1).subs = {5}
%   s(2).type = '.'   s(2).subs = 'foo'
%   s(3).type = '{}'  s(3).subs = ':'
% 
% Copyright (c) 2007 Samit Basu
% Licensed under the GPL
function b = subsref(a,s)
  for i=1:numel(s)
    switch (s(i).type)
    case '()'
      a = a(s(i).subs{:});
    case '{}'
      a = a{s(i).subs{:}};
    case '.'
      a = a.(s(i).subs);
    otherwise
      error('illegal indexing structure argument to subsref');
    end
  end
  b = a;
 |