Find offset of an element of a multi dimensional matrix - MATLAB Cody - MATLAB Central

Problem 2092. Find offset of an element of a multi dimensional matrix

Difficulty:Rate

For a given multi dimensional matrix and given element, find its offset from the 1st element.

Return 0, if element is not found in the matrix.

If the element is repeated in the matrix, then return the offset of its first occurrence in the matrix.

E.g. M(:,:,1) = [1 2 3; 4 5 6] M(:,:,2) = [10 20 30; 40 50 60]

Element is 50, then its offset = 10

Solution Stats

43.43% Correct | 56.57% 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 Solvers40

Suggested Problems

More from this Author25

Community Treasure Hunt

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

Start Hunting!
Go to top of page