comparison scripts/legacy/@inline/subsref.m @ 30911:b7edac56a810

Add functions to @inline class for Matlab compatibility (Bug #62260). * scripts/legacy/@inline/cat.m, scripts/legacy/@inline/cat.m, scripts/legacy/@inline/disp.m, scripts/legacy/@inline/exist.m, scripts/legacy/@inline/horzcat.m, scripts/legacy/@inline/nargin.m, scripts/legacy/@inline/nargout.m, scripts/legacy/@inline/symvar.m, scripts/legacy/@inline/vertcat.m: New functions * scripts/legacy/module.mk: Add new functions to build system. * scripts/legacy/@inline/argnames.m: scripts/legacy/@inline/char.m, scripts/legacy/@inline/feval.m, scripts/legacy/@inline/formula.m, scripts/legacy/@inline/subsref.m, scripts/legacy/@inline/vectorize.m: Redo documentation. Change FCN input name to FOBJ. * scripts/legacy/@inline/inline.m: Single tweak to documentation. * scripts/legacy/__vectorize__.m: Add note that this function was translated from C++. * scripts/legacy/vectorize.m: Remove incorrect note about function being translated from C++.
author Rik <rik@octave.org>
date Wed, 06 Apr 2022 21:25:58 -0700
parents 796f54d4ddbf
children 597f3ee61a48
comparison
equal deleted inserted replaced
30910:78c3dcadf130 30911:b7edac56a810
22 ## <https://www.gnu.org/licenses/>. 22 ## <https://www.gnu.org/licenses/>.
23 ## 23 ##
24 ######################################################################## 24 ########################################################################
25 25
26 ## -*- texinfo -*- 26 ## -*- texinfo -*-
27 ## @deftypefn {} {@var{value} =} subsref (@var{fcn}, @var{idx}) 27 ## @deftypefn {} {@var{value} =} subsref (@var{fobj}, @var{idx})
28 ## Perform subscripted function call on the inline function object @var{fcn}. 28 ## Perform subscripted function call on the inline function object @var{fobj}.
29 ## @end deftypefn 29 ## @end deftypefn
30 30
31 function retval = subsref (fcn, idx) 31 function retval = subsref (fobj, idx)
32 32
33 if (nargin != 2) 33 if (nargin != 2)
34 print_usage (); 34 print_usage ();
35 endif 35 endif
36 36
39 endif 39 endif
40 40
41 if (strcmp (idx(1).type, "()")) 41 if (strcmp (idx(1).type, "()"))
42 args = idx.subs; 42 args = idx.subs;
43 if (numel (args) > 0) 43 if (numel (args) > 0)
44 retval = feval (fcn, args{:}); 44 retval = feval (fobj, args{:});
45 else 45 else
46 retval = feval (fcn); 46 retval = feval (fobj);
47 endif 47 endif
48 else 48 else
49 error ("@inline/subsref: invalid subscript type"); 49 error ("@inline/subsref: invalid subscript type");
50 endif 50 endif
51 51