Cody

Problem 44504. Get a new matrix by mapping each element of an arbitrary-sized input matrix using lookup table

Solution 2977891

Submitted on 22 Sep 2020 by Benjamin
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
A = [17 24 1 8 15; 23 5 7 14 16; 4 6 13 20 22; 10 12 19 21 3; 11 18 25 2 9]; B = [1 1 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 4 4 5 ... 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 ... 7 7 7 7 7 7 7 7]; y_correct = [ 4 5 1 3 4 5 2 3 4 4 2 2 4 4 5 3 3 4 5 2 3 4 5 1 3]; assert(isequal(mapmat(A,B),y_correct));

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!