MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

# Solution 268773

Submitted on 27 Jun 2013 by Chris

Correct

87Size
Leading solution size is 16.
`This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.`

### Test Suite

Test
Code Input and Output
1
Pass

```%%
x = 3;
y = get_colorVs(x);
c0 = 0;
c1 = 0;
cw = 0;
cs = 0;
cd = 0;
for i = 1:3
cs = cs + (length(y{i})~=3);
c0 = c0 + sum(y{i}<0);
c1 = c1 + sum(y{i}>1);
cw = cw + (sum(y{i}) > 2.5);
end
for i = 1:x-1
for j = i+1:x
cd = cd + (sum(y{i}==y{j}) == 3);
end
end
assert(isequal(cs+c0+c1+cw+cd,0))
```

2
Pass

```%%
x = 12;
y = get_colorVs(x);
c0 = 0;
c1 = 0;
cw = 0;
cs = 0;
cd = 0;
for i = 1:3
cs = cs + (length(y{i})~=3);
c0 = c0 + sum(y{i}<0);
c1 = c1 + sum(y{i}>1);
cw = cw + (sum(y{i}) > 2.5);
end
for i = 1:x-1
for j = i+1:x
cd = cd + (sum(y{i}==y{j}) == 3);
end
end
assert(isequal(cs+c0+c1+cw+cd,0))
```