Convert row and column subscripts to linear indices - MATLAB Cody - MATLAB Central

Problem 58563. Convert row and column subscripts to linear indices

Difficulty:Rate
Convert 2D row and column subscripts to linear indices WITHOUT sub2ind
Example:
row = [1 2 3 1];
col = [2 2 2 3];
sz = [3 3];
ind = my_sub2ind(sz, row, col)
Returns:
ind = 1×4
4 5 6 7

Solution Stats

83.33% Correct | 16.67% Incorrect
Last Solution submitted on Oct 17, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
12
4

Problem Recent Solvers14

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page