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 17453

Submitted on 30 Jan 2012 by Ravi

Correct

12Size
Leading solution size is 12.
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 = 1:10;
[a,b,c,d] = doubleDeal(x);
y_correct = 1:4;
assert(isequal([a b c d],y_correct))
varargout =
  Columns 1 through 9
    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]    [9]
  Column 10
    [10]
2
Pass
 
%%
x = randn(1,1000);
y = cell(1,1000);
[y{:}] = doubleDeal(x);
y_correct = x;
assert(isequal([y{:}],y_correct))
varargout =
  Columns 1 through 4
    [-0.1692]    [-0.0835]    [-0.1707]    [-0.9523]
  Columns 5 through 8
    [-0.0543]    [-0.0364]    [0.2436]    [-0.6062]
  Columns 9 through 13
    [-2.5721]    [0.8819]    [-0.3503]    [0.4444]    [0.8920]
  Columns 14 through 18
    [1.0102]    [-0.7725]    [-0.8377]    [0.0684]    [0.0553]
  Columns 19 through 23
    [-0.3961]    [0.5233]    [-1.5261]    [0.4249]    [-0.6449]
  Columns 24 through 28
    [-0.7725]    [-0.6057]    [0.3458]    [0.3443]    [0.2367]
  Columns 29 through 32
    [-0.3484]    [-0.8536]    [-0.9823]    [0.1602]
  Columns 33 through 37
    [-1.2813]    [0.9287]    [-0.8867]    [-0.2139]    [0.0709]
  Columns 38 through 42
    [-0.4650]    [0.2579]    [-0.1235]    [0.3889]    [-0.3181]
  Columns 43 through 47
    [1.3200]    [-0.8509]    [-1.0493]    [-0.1396]    [1.2558]
  Columns 48 through 52
    [0.5998]    [-0.4603]    [0.5294]    [-2.2147]    [-0.7177]
  Columns 53 through 56
    [-0.1678]    [-0.1030]    [-1.3850]    [-0.9277]
  Columns 57 through 61
    [1.8280]    [0.7126]    [-0.1581]    [-0.2765]    [1.2646]
  Columns 62 through 65
    [-0.0968]    [-0.9611]    [0.4390]    [-0.8996]
  Columns 66 through 70
    [-0.7552]    [1.5485]    [-0.2513]    [0.8902]    [2.0884]
  Columns 71 through 75
    [-0.0795]    [0.1964]    [1.8335]    [-0.7622]    [-1.0441]
  Columns 76 through 80
    [0.6968]    [0.9025]    [1.0085]    [-0.4489]    [-0.8568]
  Columns 81 through 85
    [-0.8131]    [0.1055]    [0.9194]    [-2.2669]    [-0.2178]
  Columns 86 through 90
    [-0.3489]    [-0.8712]    [-0.8685]    [0.0051]    [0.8592]
  Columns 91 through 95
    [0.7336]    [1.5429]    [0.2715]    [-1.3140]    [0.4164]
  Columns 96 through 99
    [-1.2345]    [1.1548]    [-0.9064]    [-2.4534]
  Columns 100 through 104
    [-0.5151]    [-0.1976]    [1.7628]    [1.5015]    [-1.0383]
  Columns 105 through 109
    [-2.2589]    [0.7719]    [0.2935]    [-0.6517]    [0.1593]
  Columns 110 through 113
    [-0.3189]    [-1.3738]    [1.0527]    [-0.8872]
  Columns 114 through 118
    [-0.4386]    [0.5882]    [-1.3066]    [0.2932]    [-1.9204]
  Columns 119 through 123
    [-0.2950]    [-0.1802]    [-1.2164]    [1.1299]    [0.1076]
  Columns 124 through 128
    [0.3604]    [1.3456]    [-0.4110]    [-0.9196]    [-2.1679]
  Columns 129 through 133
    [0.2654]    [1.6535]    [-0.8155]    [-1.5898]    [0.2820]
  Columns 134 through 138
    [-1.2365]    [0.4696]    [-2.3409]    [1.3143]    [-1.1584]
  Columns 139 through 143
    [-0.5836]    [0.9732]    [0.5185]    [-0.6037]    [0.4181]
  Columns 144 through 147
    [-0.6070]    [-0.1047]    [0.8911]    [-1.3097]
  Columns 148 through 152
    [-0.3902]    [0.2008]    [-0.9730]    [0.1477]    [0.3078]
  Columns 153 through 157
    [-0.2664]    [-0.9092]    [-0.0528]    [0.4885]    [1.1743]
  Columns 158 through 162
    [0.6243]    [-0.3921]    [0.5485]    [-1.0754]    [1.2341]
  Columns 163 through 167
    [-0.5961]    [1.0721]    [0.2367]    [-0.1079]    [0.7931]
  Columns 168 through 172
    [0.2512]    [0.9138]    [-1.3145]    [0.2654]    [0.7600]
  Columns 173 through 176
    [-2.1744]    [-0.8974]    [-2.2438]    [0.1828]
  Columns 177 through 181
    [-1.0053]    [-1.2698]    [0.4529]    [0.8851]    [-1.1531]
  Columns 182 through 185
    [-0.4771]    [-1.4193]    [-2.2361]    [-1.2608]
  Columns 186 through 190
    [2.7910]    [0.9045]    [1.7642]    [-1.2610]    [-1.3144]
  Columns 191 through 195
    [1.0907]    [1.7223]    [1.9953]    [-0.3020]    [-0.7054]
  Columns 196 through 200
    [-0.6467]    [1.0604]    [0.8488]    [-0.3671]    [-0.9391]
  Columns 201 through 205
    [0.9965]    [1.1184]    [0.8794]    [3.1399]    [2.3028]
  Columns 206 through 210
    [-0.9005]    [0.0034]    [-0.2234]    [0.1154]    [-0.4131]
  Columns 211 through 215
    [1.2384]    [-1.5343]    [0.0817]    [2.2541]    [-1.3423]
  Columns 216 through 220
    [1.0485]    [0.6010]    [1.1803]    [0.3896]    [0.8444]
  Columns 221 through 225
    [-0.4893]    [-1.5521]    [1.8951]    [1.7467]    [0.3365]
  Columns 226 through 229
    [-0.9748]    [0.3394]    [-0.6260]    [-1.3717]
  Columns 230 through 233
    [-0.3233]    [-0.5342]    [0.4438]    [-0.5177]
  Columns 234 through 238
    [-0.2059]    [-0.1142]    [0.1688]    [-0.4621]    [1.8850]
  Columns 239 through 242
    [-0.7622]    [-1.2952]    [-0.7942]    [0.6948]
  Columns 243 through 247
    [-2.0438]    [1.1357]    [1.2290]    [-1.4583]    [-1.0804]
  Columns 248 through 252
    [0.2923]    [-1.0382]    [0.8968]    [-0.8031]    [-0.9071]
  Columns 253 through 257
    [1.0380]    [-1.5071]    [-0.6004]    [1.0258]    [0.1086]
  Columns 258 through 262
    [-0.4826]    [0.2838]    [1.5638]    [-2.1531]    [-1.2340]
  Columns 263 through 267
    [0.5192]    [-1.6241]    [0.4721]    [1.2159]    [0.6996]
  Columns 268 through 272
    [0.4061]    [0.6548]    [-1.8646]    [-0.9652]    [1.3509]
  Columns 273 through 277
    [1.2341]    [0.3163]    [0.8522]    [0.4722]    [-0.0364]
  Columns 278 through 282
    [-1.0341]    [0.0109]    [-0.6951]    [0.4576]    [0.0758]
  Columns 283 through 287
    [-0.5917]    [-0.4986]    [1.5972]    [0.0438]    [0.3059]
  Columns 288 through 292
    [1.0575]    [-1.6191]    [0.4679]    [0.4111]    [0.5694]
  Columns 293 through 297
    [0.6380]    [-0.5981]    [-0.9418]    [0.0098]    [0.0845]
  Columns 298 through 302
    [-0.7749]    [-0.7136]    [0.0117]    [0.6014]    [-0.2697]
  Columns 303 through 307
    [-1.4348]    [1.9503]    [-0.3815]    [-0.7451]    [0.5305]
  Columns 308 through 312
    [0.6631]    [0.8747]    [-0.9876]    [0.7065]    [0.5811]
  Columns 313 through 317
    [1.2213]    [2.6714]    [-0.5831]    [0.4883]    [1.0554]
  Columns 318 through 322
    [0.2660]    [-2.0152]    [-0.0274]    [0.3179]    [-0.7899]
  Columns 323 through 327
    [2.6420]    [0.1056]    [0.7115]    [0.8360]    [0.4256]
  Columns 328 through 332
    [-1.2149]    [0.5782]    [-0.8559]    [0.3916]    [0.1542]
  Columns 333 through 337
    [0.7307]    [0.6916]    [-1.4504]    [1.1213]    [-0.6078]
  Columns 338 through 342
    [0.4467]    [-1.4483]    [0.1957]    [-0.9395]    [0.6493]
  Columns 343 through 347
    [0.9938]    [-1.6568]    [-1.7709]    [0.2387]    [-0.6657]
  Columns 348 through 351
    [-0.5986]    [-0.9337]    [-0.9054]    [-0.6019]
  Columns 352 through 356
    [0.7308]    [0.5188]    [-1.5305]    [-1.9022]    [0.1421]
  Columns 357 through 361
    [-0.2318]    [0.8040]    [1.1736]    [0.2393]    [-0.2319]
  Columns 362 through 366
    [-0.9726]    [-0.2589]    [-0.4694]    [0.0846]    [1.0505]
  Columns 367 through 370
    [-0.8350]    [-0.7813]    [-0.6191]    [-0.2048]
  Columns 371 through 375
    [-1.8257]    [0.4000]    [-0.6505]    [1.1421]    [-1.0672]
  Columns 376 through 380
    [-1.1656]    [-0.7460]    [1.1278]    [0.0542]    [-0.0890]
  Columns 381 through 385
    [-1.1283]    [-0.3079]    [-0.1640]    [0.9200]    [0.7078]
  Columns 386 through 390
    [-2.2568]    [0.1790]    [0.9213]    [0.0246]    [-1.0635]
  Columns 391 through 395
    [-0.0912]    [1.0962]    [0.5615]    [-0.4596]    [-0.3836]
  Columns 396 through 400
    [0.9337]    [-1.2584]    [0.2331]    [-2.2865]    [-0.3583]
  Columns 401 through 405
    [0.9157]    [1.4899]    [0.3941]    [-0.0208]    [1.0824]
  Columns 406 through 410
    [-0.6705]    [-0.4621]    [-1.1044]    [1.0175]    [1.5104]
  Columns 411 through 415
    [0.8776]    [0.6544]    [-0.1399]    [-0.5495]    [-0.0977]
  Columns 416 through 420
    [0.9252]    [1.9491]    [1.9054]    [-1.9354]    [-0.2894]
  Columns 421 through 425
    [-0.8957]    [0.6255]    [0.1253]    [0.8695]    [0.2455]
  Columns 426 through 429
    [-0.5881]    [-0.8937]    [-0.7579]    [-0.8910]
  Columns 430 through 434
    [0.3375]    [0.1382]    [-1.2165]    [-0.2068]    [1.7076]
  Columns 435 through 439
    [1.2070]    [1.8744]    [-0.7864]    [0.5228]    [-1.2636]
  Columns 440 through 443
    [0.3128]    [-1.8793]    [-0.6425]    [-1.3978]
  Columns 444 through 447
    [7.7944e-04]    [-0.2707]    [2.1468]    [0.3780]
  Columns 448 through 452
    [0.1296]    [0.3510]    [0.8535]    [0.3138]    [-0.0357]
  Columns 453 through 457
    [-0.1807]    [0.2061]    [-0.6033]    [-0.2533]    [0.8013]
  Columns 458 through 462
    [-1.0812]    [0.3454]    [0.6667]    [0.1016]    [-0.6504]
  Columns 463 through 467
    [-0.8546]    [-1.1069]    [1.4740]    [-0.6302]    [0.4644]
  Columns 468 through 472
    [2.0874]    [-0.0553]    [0.0941]    [0.3278]    [-1.0843]
  Columns 473 through 477
    [0.6305]    [-0.1834]    [-0.8417]    [0.4525]    [1.3896]
  Columns 478 through 482
    [0.4568]    [0.5482]    [-0.0909]    [0.1460]    [-0.2993]
  Columns 483 through 486
    [-0.7042]    [-1.2145]    [0.2021]    [-0.7231]
  Columns 487 through 491
    [-0.3517]    [-1.3843]    [0.4391]    [0.9682]    [0.3874]
  Columns 492 through 496
    [0.9753]    [-0.8780]    [1.7379]    [0.1553]    [0.1462]
  Columns 497 through 501
    [-0.5524]    [-0.3030]    [0.2652]    [-2.5853]    [0.1780]
  Columns 502 through 506
    [0.9112]    [-1.6810]    [0.1949]    [0.6618]    [0.5875]
  Columns 507 through 511
    [1.4828]    [0.1927]    [-1.4744]    [-0.9569]    [-0.3129]
  Columns 512 through 516
    [-0.4716]    [0.5194]    [1.2058]    [0.8035]    [-0.7958]
  Columns 517 through 521
    [1.1870]    [1.2477]    [0.2406]    [0.9551]    [-1.7063]
  Columns 522 through 526
    [0.9662]    [1.7974]    [0.0528]    [0.3856]    [-0.5377]
  Columns 527 through 531
    [0.1333]    [1.4177]    [1.7948]    [0.8624]    [0.0625]
  Columns 532 through 536
    [-0.3330]    [0.2086]    [-0.9619]    [-0.6280]    [0.0109]
  Columns 537 through 540
    [-0.9595]    [-0.5711]    [-1.5835]    [0.1027]
  Columns 541 through 545
    [-0.6384]    [1.0468]    [-1.3982]    [0.4808]    [-1.4439]
  Columns 546 through 550
    [0.5403]    [-0.5145]    [-1.3841]    [-0.6113]    [0.0810]
  Columns 551 through 554
    [-0.4746]    [-1.9038]    [0.7274]    [-0.3918]
  Co...