sub2ind
Matrix subscript values to linear index
📝Syntax
ind = sub2ind(sz, row, col)
ind = sub2ind(sz, I1, I2, ..., In)
📥Input Arguments
Parameter Description
sz size of array: vector of positive integers.
row row subscripts.
col column subscripts.
I1, I2, ..., In multidimensional subscripts.
📤Output Arguments
Parameter Description
ind linear indices.
📄Description

ind2sub converts subscripts to linear indices. .

💡Examples
row = [2 3 4 2];
col = [2 2 2 3];
sz = [3 3];
ind = sub2ind(sz, row, col)
🔗See Also
ind2sub
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub