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

# Solution 190065

Submitted on 12 Jan 2013 by Alfonso Nieto-Castanon

Correct

87Size
`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

```%%
chars=char([32:126,161:255]);
bitmap=reshape(bitmap,size(bitmap,1),[],numel(chars));
img=sqrt(double(img(ceil(.25:.25:end),ceil(.25:.25:end)))/256);
img=img(1:floor(size(img,1)/size(bitmap,1))*size(bitmap,1),1:floor(size(img,2)/size(bitmap,2))*size(bitmap,2));
str=gray2char(img,chars,bitmap)
assert(isequal(size(str),[39 73]));
[i,loc]=ismember(str,chars);
assert(all(all(i)));
img=permute(reshape(img,size(bitmap,1),size(img,1)/size(bitmap,1),size(bitmap,2),size(img,2)/size(bitmap,2)),[1,3,2,4]);
d=mean(mean(mean(abs(bitmap(:,:,loc)-img(:,:,:)).^2,3),2),1);
assert(d<=0.102);
```
```str =
_____
Â¬ÃÃÃÃÃÃÃ¾Â¿_
ÃÃÃÃÃÃÃÃÃÃÃ¾
qÃÃÃÃÃÃÃÃÃÃÃgÂ¿                              ``
ggÃÃÃÃÃÃÃÃÃÃgQ  .Â»QÃÃÃ¿QÃÃÂ®N                         ``
_ÃÃÃÃÃÃÃÃÃÃÃ¾Â¨ÃÃÃQÃ¿Ã`ÃÃÃÃÃQÃ¾___Q                      ```
_gÃÃÃÃÃÃÃÃÃÃÃÃQÃ¿QÃÃÃÂ¯ Â¶ÃÃÃQÃÃÃ¾Â¯Â¯Â¯                      ```
gÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ¾ÃÃÃÃÃÂ½Â¡_ÃÃÃÂ¯ÃÃÃ                         ```
QÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ¾`Â¯Â°  Â¡gÃÂ¯                        ````
_ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃgÃÃÃÃÃ¾____gÃÃ                         ````
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃQÃÃÃÃÃÃÃÃÃÃÃÃÃp                        `````
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃQÃ_ÃÃÃÃ           Â²"              ``
Â¯ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃgÃÃ¾           Â·              ` ``
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ ÃÃÃÃ_          Â·                ``
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÂ¯ÃÃÃÃÃ¾ Â¨  ÃÃ                            `
gÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ  qÃÃÃ Â¨  Â¸ÃÃ¾         Â·          `     ``
Â»Â»Â»,.      gÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ   ÃMÂ¨Ã Â¨ qÃÃÃÃ¾        Â·         ``    ```
QQÂ¿Â¿Â¿QQQÃQÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ Â»Â»gÃÃ¾Â»Ã Â» . .,ÃÃpÂ¿Â¿qpÂ¿ ___`         Â¸_QpgQ
ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ_FÃQQQQÂ¡ÃÃÃ¾ÃÃÃ¾QÃÃÃÃÃgÂ¿_  _gpÃÃQÃÃQÃ
^Â»Â»Â»Â»Â²`qÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÂ¯```ÃÃÃ¾Ã¿.Ã ÃÂ¯`Â½````ÃÃÃ¾```````````````````````
```
2
Pass

```%%
chars=char([32:126,161:255]);
bitmap=reshape(bitmap,size(bitmap,1),[],numel(chars));
img=mean(ind2rgb(img.X,img.map),3);
img=double(img(ceil(.25:.25:end),ceil(.25:.25:end))).^.25;
img=img(1:floor(size(img,1)/size(bitmap,1))*size(bitmap,1),1:floor(size(img,2)/size(bitmap,2))*size(bitmap,2));
str=gray2char(img,chars,bitmap)
assert(isequal(size(str),[30 91]));
[i,loc]=ismember(str,chars);
assert(all(all(i)));
img=permute(reshape(img,size(bitmap,1),size(img,1)/size(bitmap,1),size(bitmap,2),size(img,2)/size(bitmap,2)),[1,3,2,4]);
d=mean(mean(mean(abs(bitmap(:,:,loc)-img(:,:,:)).^2,3),2),1);
assert(d<=0.172);
```
```str =
Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯*Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯Â¯
`Â«        Â»9ÂªÂ¨              Â¯"Â²Â²QQ__````.`      Â·` Â· `      ``
`        `Â·      Â«Â¨                       Â¯ÃÃÃqqÂ»Â·         .Â·
Â»      `                             Â¯ÃQÂ´Â·      `
Â¿.`__Â«       :*     `                  _Â¸_             Â»Â».        .`` Â·
Â´Â¯Â¯ÃÂ¨Â¨Â¨Â»:.  !`    :Â´                 Â¸ÃQÃÃ¿Ã¾        ```Â³Â¼ Â»     Â´`;````` ```
Â»Â·                    Â¸Â¨Â´Q_.     Â³Â²         ..Â¸Â»Â·   Â´7ÃÃÃÃÃ      .. ``  `Â«Â·`  `   Â·     `Â·.
ÃÂ»                    ÃÂ©ÃÃÃÃ:    Ã          _Â¸..  Â´  _QÃÃÂ»       Â¸       `Â»``Â¸Â¸`:Â·Â· `     Â·
Ã¾Â»`Â¸           .`      Â²Â«Â».Ã¦Â²   iÂ¯  Â¸Â¡Â»Â©Â»Â»Â»Â«``:Â·Â¸;Â¯ .Ã½ÃÃÃ       .`    Â·Â«Â».`Â¨`Â»Â»Â¨`.`   `   `