% -*- texinfo -*- % @deftypefn {Function File} {@var{ind} =} sub2ind (@var{dims}, @var{i}, @var{j}) % @deftypefnx {Function File} {@var{ind} =} sub2ind (@var{dims}, @var{s1}, @var{s2}, @dots{}, @var{sN}) % Convert subscripts into a linear index. % % The following example shows how to convert the two-dimensional % index @code{(2,3)} of a 3-by-3 matrix to a linear index. The matrix % is linearly indexed moving from one column to next, filling up % all rows in each column. % % @example % @group % linear_index = sub2ind ([3, 3], 2, 3) % @result{} 8 % @end group % @end example % @seealso{ind2sub} % @end deftypefn