Home > freetb4matlab > general > subsindex.m

subsindex

PURPOSE ^

% Convert an object to an index vector. When @var{a} is a class object

SYNOPSIS ^

function idx = subsindex (a)

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {@var{idx} =} subsindex (@var{a})
% Convert an object to an index vector.  When @var{a} is a class object 
% defined with a class constructor, then @code{subsindex} is the
% overloading method that allows the conversion of this class object to
% a valid indexing vector.  It is important to note that
% @code{subsindex} must return a zero-based real integer vector of the
% class 'double'.  For example, if the class constructor
%
% @example
% @group
% function b = myclass (a)
%  b = myclass (struct ('a', a), 'myclass');
% 
% @end group
% @end example
%
% @noindent
% then the @code{subsindex} function
%
% @example
% @group
% function idx = subsindex (a)
%  idx = double (a.a) - 1.0;
% 
% @end group
% @end example
%
% @noindent
% can then be used as follows
%
% @example
% @group
% a = myclass (1:4);
% b = 1:10;
% b(a)
% @result{} 1  2  3  4
% @end group
% @end example
%
% @seealso{class, subsref, subsasgn}
% @end deftypefn

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003