Cody

Problem 1948. Convert this color - RGB Vector to Hex String

Solution 2178991

Submitted on 28 Mar 2020 by Takuma Mitamura
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = [0,0,0.0001]; y_correct = '000000'; assert(isequal(rgb2hex(x),y_correct))

hexString = "000000"

2   Pass
x = [1,1,1]; y_correct = 'FFFFFF'; assert(isequal(rgb2hex(x),y_correct))

hexString = "FFFFFF"

3   Pass
x = [.5,.5,.2]; y_correct = '7F7F33'; assert(isequal(rgb2hex(x),y_correct))

hexString = "7F7F33"

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!