Given a 2D array of ones and zeros, generate an equivalent sized checkerboard array of ones and twos. The checkerboard pattern starts with 2:
[2,1,2,1,2; 1,2,1,2,1; 2,1,2,1,2];
Then set this checkerboard array to zero wherever the original was zero.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers32
Suggested Problems
-
Matrix with different incremental runs
592 Solvers
-
Detect a number and replace with two NaN's
200 Solvers
-
5937 Solvers
-
Rounding off numbers to n decimals
5747 Solvers
-
Find the sum of the largest two elements in a vector
119 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
You should add a test case where the last row and/or last column of x contains only zeroes.