Scroll to navigation

MAT_CALCSINGLESUBSCRIPT2(3) Library Functions Manual MAT_CALCSINGLESUBSCRIPT2(3)

NAME

Mat_CalcSingleSubscript2Converts MATLAB-style subscripts to a 0-relative linear index using size_t arrays.

SYNOPSIS

#include <matio.h>

int
Mat_CalcSingleSubscript2(int rank, const size_t *dims, const size_t *subs, size_t *index);

DESCRIPTION

The () function converts a set of 1-relative MATLAB-style subscripts in subs for an array with dimensions dims and rank rank into a 0-relative linear index stored in *index. The caller should initialize *index to 0 before calling the function. Each subscript must be in the range 1 through the corresponding dimension size.

RETURN VALUES

The function returns 0 on success. Otherwise, a matio error code is returned.

EXAMPLES

size_t dims[2] = {3, 4};
size_t subs[2] = {2, 3};
size_t index = 0;

Mat_CalcSingleSubscript2(2, dims, subs, &index);

SEE ALSO

Mat_CalcSingleSubscript(3)

April 23, 2026 Nixpkgs