Cody

Problem 540. Convert hex color specification to MATLAB RGB

Solution 528911

Submitted on 14 Nov 2014 by goc3
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
%% hex = '#0000FF'; rgb = [0 0 1]; assert(isequal(color_hex2rgb(hex),rgb))

HEX = 0000FF HEX = 48 48 48 48 70 70

2   Pass
%% hex = '#33FF00'; rgb = [0.2 1 0]; assert(isequal(color_hex2rgb(hex),rgb))

HEX = 33FF00 HEX = 51 51 70 70 48 48

3   Pass
%% hex = '#FFCCFF'; rgb = [1 0.8 1]; assert(isequal(color_hex2rgb(hex),rgb))

HEX = FFCCFF HEX = 70 70 67 67 70 70

4   Pass
%% hex = '#999999'; rgb = [.6 .6 .6]; assert(isequal(color_hex2rgb(hex),rgb))

HEX = 999999 HEX = 57 57 57 57 57 57

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!