Draw a Diamond shape in ones Matrix with '0' s - MATLAB Cody - MATLAB Central

Problem 54705. Draw a Diamond shape in ones Matrix with '0' s

Difficulty:Rate
Input will be odd numbers.The task is to make a Diamond shape in a ones matrix with '0's where the matrix will be a square matrix of length and width equal to the input. For Example, Input x=3, output will be:
y =
1 0 1
0 1 0
1 0 1

Solution Stats

54.9% Correct | 45.1% Incorrect
Last Solution submitted on Oct 30, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
12
4

Problem Recent Solvers25

Suggested Problems

Community Treasure Hunt

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

Start Hunting!
Go to top of page