Dice face matrix! - MATLAB Cody - MATLAB Central

Problem 1719. Dice face matrix!

Difficulty:Rate

This is dice simulator, but instead of making a random die number, you will receive an "pre-rolled" number in and spit out a matrix of 1 and 0 that looks like a dice face of the given number. So for example:

rollnum = 1;

Then the output will be:

diceFace =
       0     0     0
       0     1     0
       0     0     0

Another example:

rollnum = 5;

Then the output will be:

diceFace =
       1     0     1
       0     1     0
       1     0     1
And so on for 1-6, well that is it!
Just note the 1 and 0 are numbers not char's or strings...
Good luck!

Solution Stats

64.5% Correct | 35.5% Incorrect
Last Solution submitted on May 09, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
3
5
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

Problem Recent Solvers112

Suggested Problems

More from this Author17

Community Treasure Hunt

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

Start Hunting!
Go to top of page