Cody

Problem 45197. find subscripts from linear index

Solution 2204006

Submitted on 10 Apr 2020 by Nabil Chowdhury
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = [2,3,4;5,6,7;1,35,6]; n=7; y_correct = [1;3]; assert(isequal(lin_ind(x,n),y_correct))

y = 1 3

2   Pass
x = [2,3,4;5,6,7;1,35,6]; n=10; y_correct = []; assert(isequal(lin_ind(x,n),y_correct))

3   Pass
x = [2,3,4;5,6,7;1,35,6]; n=[6,7]; y_correct = [3,1;2,3]; assert(isequal(lin_ind(x,n),y_correct))

y = 3 1 2 3

4   Pass
x=eye(5); n=17; y_correct =[2;4]; assert(isequal(lin_ind(x,n),y_correct))

y = 2 4

Suggested Problems

More from this Author149

Community Treasure Hunt

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

Start Hunting!