Cody

Problem 44031. Matrix Manipulation

Solution 1111257

Submitted on 27 Jan 2017 by Alexander Levedahl
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 = [3 2 1 3; 3 0 0 1; 0 4 3 1]; y = matrixManipulation(x); v = 3:15; assert(isequal(x(1,:),y(1,:))) assert(isempty(setdiff(y(2,:),v))) assert(isempty(setdiff(y(3,:),v)))

t = 6 10 9 7 11 8 13 13 14 10 11 7 ans = [] a = 3×1 logical array 0 1 1 ans = [] x = 3 2 1 3 11 8 13 13 14 10 11 7 ans = []

2   Pass
x = eye(4); y = matrixManipulation(x); v = 3:15; for i = 1:4 assert(isempty(setdiff(y(i,:),v))) end

t = 13 11 12 10 13 11 13 6 5 7 10 11 13 10 12 3 ans = [] a = 4×1 logical array 1 1 1 1 ans = [] x = 13 11 12 10 13 11 13 6 5 7 10 11 13 10 12 3 ans = []

3   Pass
x = ones(4); y = matrixManipulation(x); assert(isequal(x,y))

t = 11 8 11 13 13 15 6 10 8 4 14 9 9 15 7 13 ans = [] a = 4×1 logical array 0 0 0 0 ans = [] x = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ans = []

Community Treasure Hunt

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

Start Hunting!