Cody

# Problem 42849. RGB to CMYK

Solution 3012484

Submitted on 1 Oct 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   Pass
RGB = [0,0,0]; CMYK = [0,0,0,1]; assert(isequal(rgb2cmyk(RGB),CMYK))

c = 0 0 0 c = 0 0 0 1 CMYK = 0 0 0 1

2   Pass
RGB = [1,1,1]; CMYK = [0,0,0,0]; assert(isequal(rgb2cmyk(RGB),CMYK))

c = 1 1 1 c = 0 0 0 0 CMYK = 0 0 0 0

3   Pass
RGB = [1,0,0]; CMYK = [0,1,1,0]; assert(isequal(rgb2cmyk(RGB),CMYK))

c = 1 0 0 c = 0 1 1 0 CMYK = 0 1 1 0

4   Pass
RGB = [1,1,0]; CMYK = [0,0,1,0]; assert(isequal(rgb2cmyk(RGB),CMYK))

c = 1 1 0 c = 0 0 1 0 CMYK = 0 0 1 0

5   Fail
RGB = [150,25,0]/255; CMYK = [0,5/6,1,7/17]; error = abs(rgb2cmyk(RGB)-CMYK); assert(all(error<1e-4))

c = 0.5882 0.0980 0 c = 0 0.4902 0.5882 0.4118 CMYK = 0 0.4902 0.5882 0.4118

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!