Cody

Problem 2948. Create an m x n array consisting only of an input value.

Solution 1783136

Submitted on 11 Apr 2019
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
m = 5; n = 4; x = 5; y_correct = [5 5 5 5; 5 5 5 5; 5 5 5 5; 5 5 5 5; 5 5 5 5] assert(isequal(array_x(m,n,x),y_correct));

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

2   Fail
m = 4; n = 3; x = -7; y_correct = [-7 -7 -7; -7 -7 -7; -7 -7 -7; -7 -7 -7] assert(isequal(array_x(m,n,x),y_correct));

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

3   Fail
m = 2; n = 6; x = 11; y_correct = [11 11 11 11 11 11; 11 11 11 11 11 11] assert(isequal(array_x(m,n,x),y_correct));

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

4   Fail
m = 8; n = 1; x = 42; y_correct = [42; 42; 42; 42; 42; 42; 42; 42] assert(isequal(array_x(m,n,x),y_correct));

Error in solution Line: 4 Column: 10 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!