Cody

Problem 42875. Assignment Problem

Solution 2502593

Submitted on 9 Jun 2020
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   Fail
x = [2,12,8,5; 4,4,5,12; 3,10,8,3; 12,0,1,2]; y_correct1 = [1,2,4,3]; y_correct2 = [1,4,2,3]; test1 = isequal(Assignment(x),y_correct1); test2 = isequal(Assignment(x),y_correct2); assert(test1||test2)

Error in solution: Line: 15 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

2   Fail
x = [7,5,3,2,6; 6,3,6,6,5; 3,3,9,4,7; 4,5,3,3,4; 2,3,4,3,5]; y_correct = [5,3,4,1,2]; assert(isequal(Assignment(x),y_correct))

Error in solution: Line: 15 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

3   Fail
x = eye(4); x(x==0) = 3; y_correct = 1:4; assert(isequal(Assignment(x),y_correct))

Error in solution: Line: 15 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

4   Fail
x = 5 * ones(5); x(1,4) = 1; x(2,2) = 1; x(3,5) = 1; x(4,1) = 1; x(5,3) = 1; y_correct = [4,2,5,1,3]; assert(isequal(Assignment(x),y_correct))

Error in solution: Line: 15 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

5   Fail
x = 1:4; x = [x; circshift(x,1); circshift(x,2); circshift(x,3)]; y_correct = 1:4; assert(isequal(Assignment(x),y_correct))

Error in solution: Line: 15 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

6   Fail
x = [7,5,4; 14,16,2; 7,1,9]; y_correct = [1,3,2]; assert(isequal(Assignment(x),y_correct))

Error in solution: Line: 15 Column: 16 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

Community Treasure Hunt

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

Start Hunting!