Functions

sub2ind.cc File Reference

#include "quit.h"
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "oct-obj.h"
Include dependency graph for sub2ind.cc:

Go to the source code of this file.

Functions

 DEFUN_DLD (sub2ind, args,,"-*- texinfo -*-\n\ @deftypefn {Function File} {@var{ind} =} sub2ind (@var{dims}, @var{i}, @var{j})\n\ @deftypefnx {Function File} {@var{ind} =} sub2ind (@var{dims}, @var{s1}, @var{s2}, @dots{}, @var{sN})\n\ Convert subscripts to a linear index.\n\ \n\ The following example shows how to convert the two-dimensional\n\ index @code{(2,3)} of a 3-by-3 matrix to a linear index. The matrix\n\ is linearly indexed moving from one column to next, filling up\n\ all rows in each column.\n\ \n\ @example\n\ @group\n\ linear_index = sub2ind ([3, 3], 2, 3)\n\ @result{} 8\n\ @end group\n\ @end example\n\ @seealso{ind2sub}\n\ @end deftypefn")
 DEFUN_DLD (ind2sub, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Function File} {[@var{s1}, @var{s2}, @dots{}, @var{sN}] =} ind2sub (@var{dims}, @var{ind})\n\ Convert a linear index to subscripts.\n\ \n\ The following example shows how to convert the linear index @code{8}\n\ in a 3-by-3 matrix into a subscript. The matrix is linearly indexed\n\ moving from one column to next, filling up all rows in each column.\n\ \n\ @example\n\ @group\n\ [r, c] = ind2sub ([3, 3], 8)\n\ @result{} r = 2\n\ c = 3\n\ @end group\n\ @end example\n\ @seealso{sub2ind}\n\ @end deftypefn")
static dim_vector get_dim_vector (const octave_value &val, const char *name)

Function Documentation

DEFUN_DLD ( sub2ind  ,
args   
)

Definition at line 64 of file sub2ind.cc.

References error(), error_state, get_dim_vector(), print_usage(), dim_vector::redim(), and sub2ind().

DEFUN_DLD ( ind2sub  ,
args  ,
nargout   
)
static dim_vector get_dim_vector ( const octave_value val,
const char name 
) [static]

Definition at line 36 of file sub2ind.cc.

References error(), Array< T >::length(), max(), dim_vector::resize(), and octave_value::row_vector_value().

Referenced by DEFUN_DLD().

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines