Cody

Solution 736316

Submitted on 15 Sep 2015 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
%% rgb = [1 1 0; 1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 1 1 1; 0 0 0]; str = 'ymcrgbwk'; for ii=1:size(rgb,1) assert(isequal(rgb2str(rgb(ii,:)),str(ii))) end

rgb = 1 1 0 str = y rgb = 1 0 1 str = m rgb = 0 1 1 str = c rgb = 1 0 0 str = r rgb = 0 1 0 str = g rgb = 0 0 1 str = b rgb = 1 1 1 str = w rgb = 0 0 0 str = k

2   Pass
%% rgb = [1 1 0; 1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 1 1 1; 0 0 0]; str = 'ymcrgbwk'; for ii=1:size(rgb,1) assert(isequal(rgb2str(rgb(ii,:),'short'),str(ii))) end

rgb = 1 1 0 str = y rgb = 1 0 1 str = m rgb = 0 1 1 str = c rgb = 1 0 0 str = r rgb = 0 1 0 str = g rgb = 0 0 1 str = b rgb = 1 1 1 str = w rgb = 0 0 0 str = k

3   Pass
%% rgb = [1 1 0; 1 0 1; 0 1 1; 1 0 0; 0 1 0; 0 0 1; 1 1 1; 0 0 0]; str = {'yellow','magenta','cyan','red','green','blue','white','black'}; for ii=1:size(rgb,1) assert(isequal(rgb2str(rgb(ii,:),'long'),str{ii})) end

rgb = 1 1 0 str = yellow rgb = 1 0 1 str = magenta rgb = 0 1 1 str = cyan rgb = 1 0 0 str = red rgb = 0 1 0 str = green rgb = 0 0 1 str = blue rgb = 1 1 1 str = white rgb = 0 0 0 str = black

4   Pass
%% rng('default'); rgb = rand(8,3); for ii=1:size(rgb,1) assert(isequal(rgb2str(rgb(ii,:)),'')) end

rgb = 0.8147 0.9575 0.4218 rgb = 0.9058 0.9649 0.9157 rgb = 0.1270 0.1576 0.7922 rgb = 0.9134 0.9706 0.9595 rgb = 0.6324 0.9572 0.6557 rgb = 0.0975 0.4854 0.0357 rgb = 0.2785 0.8003 0.8491 rgb = 0.5469 0.1419 0.9340

5   Pass
%% rng(673); rgb = round(rand(8,3)*10)/10; for ii=1:size(rgb,1) assert(isequal(rgb2str(rgb(ii,:),'short'),'')) end

rgb = 0.2000 0.2000 0.6000 rgb = 0.1000 0.3000 1.0000 rgb = 0.1000 0.4000 0.8000 rgb = 0 0.3000 0 rgb = 0.8000 0.9000 0.1000 rgb = 0.5000 0.8000 0.8000 rgb = 0.2000 0.3000 0.6000 rgb = 0.6000 0.4000 0.4000

6   Pass
%% rgb = round(rand(8,3)*10)/10; for ii=1:size(rgb,1) assert(isequal(rgb2str(rgb(ii,:),'long'),'')) end

rgb = 0.8000 0.2000 0.8000 rgb = 0.4000 1.0000 0.5000 rgb = 0.9000 0.5000 0.5000 rgb = 0.7000 0.7000 0.5000 rgb = 0.6000 0.2000 0.7000 rgb = 0.5000 0.2000 0.8000 rgb = 0.3000 0.7000 0.7000 rgb = 0.7000 0.8000 0.3000