Problem 1948. Convert this color - RGB Vector to Hex String
Given a 3 element RGB vector corresponding to a color (given by the MATLAB color spec http://www.mathworks.com/help/matlab/ref/colorspec.html), return the corresponding hex value string associated with it. This hex value string is often used when coding in HTML to specify a color.
For example, given the vector [0, 1, 1], you would return the string 00FFFF and given the vector [.5 .5 .2], you would return the string 7F7F33. We will assume that in this case once we multiply the vector by 255, we will round down to the nearest integer. If anyone thinks that we should not assume rounding down, feel free to comment :)
Solution Stats
Problem Comments
-
1 Comment
The problem claims that we should round to the nearest integer, but it is actually using the function floor.
Solution Comments
Show commentsProblem Recent Solvers138
Suggested Problems
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
554 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
13483 Solvers
-
Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
2025 Solvers
-
438 Solvers
-
345 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!