Make a diamond - MATLAB Cody - MATLAB Central

Problem 1078. Make a diamond

Difficulty:Rate

Given n, odd number > 1, return n by n matrix consist of "null" and "*" characters arranged like a diamond.

No toolbox functions please.

n = 3

m =

 *
* *
 *

n = 7

m =

   *   
  * *  
 *   *  
*     *
 *   *  
  * *
   *

Solution Stats

30.27% Correct | 69.73% Incorrect
Last Solution submitted on May 06, 2025

Problem Comments

Solution Comments

Show comments
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Group

Matrix Patterns III Image
Matrix Patterns III
  • 12 Problems
  • 47 Finishers

Problem Recent Solvers91

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page