Cody

Problem 1273. Max index of 3D array

Solution 2980111

Submitted on 22 Sep 2020 by Jeremy Perez
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 = zeros(10,10,10); x(5,5,5) = 10; y_correct = [5,5,5]; assert(isequal(Index_Max3d(x),y_correct))

ans = 445 a = 5 b = 5 c = 5 ans = 5 5 5

2   Pass
x = randn(10,10,10); x(7,5,8) = 11; y_correct = [7,5,8]; assert(isequal(Index_Max3d(x),y_correct))

ans = 747 a = 7 b = 5 c = 8 ans = 7 5 8

3   Pass
x = randn(10,10,100); x(10,5,8) = 99; y_correct = [10,5,8]; assert(isequal(Index_Max3d(x),y_correct))

ans = 750 a = 10 b = 5 c = 8 ans = 10 5 8

4   Pass
x = randn(10,10,10); x(1,3,7) = 42; y_correct = [1,3,7]; assert(isequal(Index_Max3d(x),y_correct))

ans = 621 a = 1 b = 3 c = 7 ans = 1 3 7

5   Pass
x = randn(10,10,100); x(4,4,7) = 123456789; y_correct = [4,4,7]; assert(isequal(Index_Max3d(x),y_correct))

ans = 634 a = 4 b = 4 c = 7 ans = 4 4 7

6   Pass
x = randn(10,10,10); x(1,1,9) = 10701; y_correct = [1,1,9]; assert(isequal(Index_Max3d(x),y_correct))

ans = 801 a = 1 b = 1 c = 9 ans = 1 1 9

7   Pass
x = randn(10,10,100); x(1,7,3) = 10701; y_correct = [1,7,3]; assert(isequal(Index_Max3d(x),y_correct))

ans = 261 a = 1 b = 7 c = 3 ans = 1 7 3

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!