Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 82738

Submitted on 26 Apr 2012 by Brett Shoelson

Correct

97Size
Leading solution size is 30.
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
 
%%
blockSize    = 2;
numColBlocks = 6;
numRowBlocks = 4;
RGBvec = spring(numColBlocks*numRowBlocks)*255;
y_correct(:,:,1) =[
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255
  255  255  255  255  255  255  255  255  255  255  255  255];
y_correct(:,:,2) = [
    0    0   11   11   22   22   33   33   44   44   55   55
    0    0   11   11   22   22   33   33   44   44   55   55
   67   67   78   78   89   89  100  100  111  111  122  122
   67   67   78   78   89   89  100  100  111  111  122  122
  133  133  144  144  155  155  166  166  177  177  188  188
  133  133  144  144  155  155  166  166  177  177  188  188
  200  200  211  211  222  222  233  233  244  244  255  255
  200  200  211  211  222  222  233  233  244  244  255  255];
y_correct(:,:,3) = [
  255  255  244  244  233  233  222  222  211  211  200  200
  255  255  244  244  233  233  222  222  211  211  200  200
  188  188  177  177  166  166  155  155  144  144  133  133
  188  188  177  177  166  166  155  155  144  144  133  133
  122  122  111  111  100  100   89   89   78   78   67   67
  122  122  111  111  100  100   89   89   78   78   67   67
   55   55   44   44   33   33   22   22   11   11    0    0
   55   55   44   44   33   33   22   22   11   11    0    0];
assert(isequal(makeColorBlocks(blockSize, numColBlocks, numRowBlocks, RGBvec),y_correct))