Problem 55770. Jack O'Lantern
If visualized correctly, the data contained in the matrix A will look like a jack-o'-lantern.
Create a function that will visualize A as an indexed color image. Make sure the orientation of the face is correct! Remove the x-ticks and y-ticks. Change the colormap so that the background (A has the value 1) is white, the facial features (A has the value 0) are black, and the face (A has the value 0.5) is orange.
Your function should return the figure handle as output.
A simple test case:
A = [1 0.5 0.5 0.5 0.5 1;
0.5 0.5 0.5 0.5 0.5 0.5;
0.5 0 0.5 0.5 0 0.5;
0.5 0.5 0.5 0.5 0.5 0.5;
0.5 0 0.5 0.5 0 0.5;
0.5 0.5 0 0 0.5 0.5;
1 0.5 0.5 0.5 0.5 1];
smileyFace(A)
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers75
Suggested Problems
-
Maximum running product for a string of numbers
2104 Solvers
-
Project Euler: Problem 2, Sum of even Fibonacci
2166 Solvers
-
Project Euler: Problem 10, Sum of Primes
1645 Solvers
-
Electrical Diode Current Calculation
505 Solvers
-
String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
1351 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!