sub2ind(): number | array
Converts 2D subscripts to linear indices.
Converts 2D coordinates [X, Y] into linear indices based on the given matrix size.
Convert single 2D coordinate to linear index
Convert single 2D coordinate to linear index
import { assertEquals } from "jsr:@std/assert"; assertEquals(sub2ind([2, 3], [1, 2]), 5);
number | array
The computed linear index or an array of indices.