Cody

Solution 2200146

Submitted on 8 Apr 2020
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   Fail
x = [0,0,0.0001]; y_correct = '000000'; assert(isequal(rgb2hex(x),y_correct))

Array indices must be positive integers or logical values. Error in rgb2hex (line 6) hexString(2*i)=h((floor(n)-n)*16+1); Error in Test1 (line 3) assert(isequal(rgb2hex(x),y_correct))

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

Array indices must be positive integers or logical values. Error in rgb2hex (line 6) hexString(2*i)=h((floor(n)-n)*16+1); Error in Test2 (line 3) assert(isequal(rgb2hex(x),y_correct))

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

Array indices must be positive integers or logical values. Error in rgb2hex (line 6) hexString(2*i)=h((floor(n)-n)*16+1); Error in Test3 (line 3) assert(isequal(rgb2hex(x),y_correct))

Suggested Problems

More from this Author4