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:
1 9 5 7
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:
7 5 9 1
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:
..NN.. WW..EE ..SS..
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
Problem Comments
-
2 Comments
I solved the problem using repmat but it gives a message that
"There was an issue submitting your solution
Remove inappropriate content. For guidelines, see About Cody"
Can anybody help me out ......
awesome problem!
Solution Comments
Show commentsProblem Recent Solvers344
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6322 Solvers
-
4637 Solvers
-
451 Solvers
-
Sum of diagonal of a square matrix
1583 Solvers
-
1846 Solvers
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!