Problem 45172. Cross ("+") flag returns
Given two numbers, [m, n], return a matrix of size m x n which has all elements of the centre column and centre row set as 1, and all other elements in the matrix set as 0.
Given two even numbers, [p, q], return a matrix of size p x q which has the centre band of two numbers set as 1. However, there must be at least four zeros on the outer corners of the matrix.
For example, [m, n] = [3, 3] would return:
[0,1,0;
1,1,1;
0,1,0];
And for even numbers: [p, q] = [4, 3] would return
[0,1,0;
1,1,1;
1,1,1;
0,1,0];
Solution Stats
Problem Comments
-
6 Comments
Show
3 older comments
William
on 14 Oct 2019
It seems to me that the result for [m,n]=[4,4] is incorrect.
Rafael S.T. Vieira
on 12 Aug 2020
Yes it is, William. It should be the 2x2 case (instead of 4x4), which should be all zeros.
goc3
on 29 Sep 2020
The test suite has been updated.
Christian Schröder
on 24 Nov 2022
The first test is broken --- it doesn't actually invoke the function.
Dyuman Joshi
on 25 Nov 2022
Test case #1 has been corrected and solutions were re-scored.
Christian Schröder
on 25 Nov 2022
Thanks, Dyuman!
Solution Comments
Show commentsProblem Recent Solvers17
Suggested Problems
-
2315 Solvers
-
2989 Solvers
-
Matrix with different incremental runs
125 Solvers
-
Find my daddy long leg (No 's')
2384 Solvers
-
Is this is a Tic Tac Toe X Win?
511 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!