Problem 535. Rotate and display numbered tile

Imagine a square tile with four numbers on it, one on each edge. We will call these edges north, east, south, and west.

If the four numbers were [1 5 7 9], this vector would be displayed with the numbers going around clockwise from the north like so:

  9   5

But the tile can appear in four different orientations. Let's say that when the north is 1, then the first number appears in the north position. If north is 2, then the second number appears in the north position, and so on. So if the tile numbers are [1 5 7 9] and the orientation parameter north is 3, then it would display like so, since 7 is the third number:

  5   9

The numbers you are given will always be one or two digit positive integers. You must return a 3-by-6 character array that fits this template:


where dots are used to indicate spaces (ASCII 32). One digit numbers should be right aligned. In the example given immediately above, the output should look like this:

 Inputs t = [1 5 7 9], north = 3
 Output is  ['   7  '
             ' 5   9'
             '   1  ']

Solution Stats

33.36% Correct | 66.64% Incorrect
Last Solution submitted on Jan 05, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers343

Suggested Problems

More from this Author50

Problem Tags

Community Treasure Hunt

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

Start Hunting!