This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = ones(1,25);
n=[0,2];
y_correct = x;
assert(isequal(limit2interval(x,n),y_correct))
|
2 | Pass |
x= [1 2 3 4 5 1 2 4 6];
n=[3,5];
y_correct= [3 3 3 4 5 3 3 4 5];
assert(isequal(limit2interval(x,n),y_correct))
|
3 | Pass |
x= magic(7);
n=[7,14];
y_correct=ones(7)*14-sparse([4 5 3 2 3 1 2 1 7 6 7 5 6],[1 1 2 3 3 4 4 5 5 6 6 7 7],[7 1 7 7 6 7 5 4 7 7 3 7 2])
assert(isequal(limit2interval(x,n),y_correct))
y_correct =
14 14 14 7 10 14 14
14 14 7 9 14 14 14
14 7 8 14 14 14 14
7 14 14 14 14 14 14
13 14 14 14 14 14 7
14 14 14 14 14 7 12
14 14 14 14 7 11 14
|
The Hitchhiker's Guide to MATLAB
2874 Solvers
Program an exclusive OR operation with logical operators
639 Solvers
445 Solvers
187 Solvers
354 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!