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 94769

Submitted on 2 Jun 2012 by Mark

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 8
    [1]    [2]    [3]    [4]    [5]    [6]    [7]    [8]
  Columns 9 through 10
    [9]    [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 5
    [0.5377]    [1.8339]    [-2.2588]    [0.8622]    [0.3188]
  Columns 6 through 9
    [-1.3077]    [-0.4336]    [0.3426]    [3.5784]
  Columns 10 through 13
    [2.7694]    [-1.3499]    [3.0349]    [0.7254]
  Columns 14 through 17
    [-0.0631]    [0.7147]    [-0.2050]    [-0.1241]
  Columns 18 through 22
    [1.4897]    [1.4090]    [1.4172]    [0.6715]    [-1.2075]
  Columns 23 through 27
    [0.7172]    [1.6302]    [0.4889]    [1.0347]    [0.7269]
  Columns 28 through 31
    [-0.3034]    [0.2939]    [-0.7873]    [0.8884]
  Columns 32 through 35
    [-1.1471]    [-1.0689]    [-0.8095]    [-2.9443]
  Columns 36 through 39
    [1.4384]    [0.3252]    [-0.7549]    [1.3703]
  Columns 40 through 43
    [-1.7115]    [-0.1022]    [-0.2414]    [0.3192]
  Columns 44 through 47
    [0.3129]    [-0.8649]    [-0.0301]    [-0.1649]
  Columns 48 through 52
    [0.6277]    [1.0933]    [1.1093]    [-0.8637]    [0.0774]
  Columns 53 through 56
    [-1.2141]    [-1.1135]    [-0.0068]    [1.5326]
  Columns 57 through 60
    [-0.7697]    [0.3714]    [-0.2256]    [1.1174]
  Columns 61 through 65
    [-1.0891]    [0.0326]    [0.5525]    [1.1006]    [1.5442]
  Columns 66 through 69
    [0.0859]    [-1.4916]    [-0.7423]    [-1.0616]
  Columns 70 through 73
    [2.3505]    [-0.6156]    [0.7481]    [-0.1924]
  Columns 74 through 77
    [0.8886]    [-0.7648]    [-1.4023]    [-1.4224]
  Columns 78 through 81
    [0.4882]    [-0.1774]    [-0.1961]    [1.4193]
  Columns 82 through 86
    [0.2916]    [0.1978]    [1.5877]    [-0.8045]    [0.6966]
  Columns 87 through 90
    [0.8351]    [-0.2437]    [0.2157]    [-1.1658]
  Columns 91 through 94
    [-1.1480]    [0.1049]    [0.7223]    [2.5855]
  Columns 95 through 98
    [-0.6669]    [0.1873]    [-0.0825]    [-1.9330]
  Columns 99 through 102
    [-0.4390]    [-1.7947]    [0.8404]    [-0.8880]
  Columns 103 through 106
    [0.1001]    [-0.5445]    [0.3035]    [-0.6003]
  Columns 107 through 110
    [0.4900]    [0.7394]    [1.7119]    [-0.1941]
  Columns 111 through 114
    [-2.1384]    [-0.8396]    [1.3546]    [-1.0722]
  Columns 115 through 118
    [0.9610]    [0.1240]    [1.4367]    [-1.9609]
  Columns 119 through 122
    [-0.1977]    [-1.2078]    [2.9080]    [0.8252]
  Columns 123 through 126
    [1.3790]    [-1.0582]    [-0.4686]    [-0.2725]
  Columns 127 through 130
    [1.0984]    [-0.2779]    [0.7015]    [-2.0518]
  Columns 131 through 134
    [-0.3538]    [-0.8236]    [-1.5771]    [0.5080]
  Columns 135 through 139
    [0.2820]    [0.0335]    [-1.3337]    [1.1275]    [0.3502]
  Columns 140 through 143
    [-0.2991]    [0.0229]    [-0.2620]    [-1.7502]
  Columns 144 through 147
    [-0.2857]    [-0.8314]    [-0.9792]    [-1.1564]
  Columns 148 through 151
    [-0.5336]    [-2.0026]    [0.9642]    [0.5201]
  Columns 152 through 155
    [-0.0200]    [-0.0348]    [-0.7982]    [1.0187]
  Columns 156 through 159
    [-0.1332]    [-0.7145]    [1.3514]    [-0.2248]
  Columns 160 through 163
    [-0.5890]    [-0.2938]    [-0.8479]    [-1.1201]
  Columns 164 through 167
    [2.5260]    [1.6555]    [0.3075]    [-1.2571]
  Columns 168 through 171
    [-0.8655]    [-0.1765]    [0.7914]    [-1.3320]
  Columns 172 through 175
    [-2.3299]    [-1.4491]    [0.3335]    [0.3914]
  Columns 176 through 179
    [0.4517]    [-0.1303]    [0.1837]    [-0.4762]
  Columns 180 through 183
    [0.8620]    [-1.3617]    [0.4550]    [-0.8487]
  Columns 184 through 187
    [-0.3349]    [0.5528]    [1.0391]    [-1.1176]
  Columns 188 through 191
    [1.2607]    [0.6601]    [-0.0679]    [-0.1952]
  Columns 192 through 195
    [-0.2176]    [-0.3031]    [0.0230]    [0.0513]
  Columns 196 through 200
    [0.8261]    [1.5270]    [0.4669]    [-0.2097]    [0.6252]
  Columns 201 through 205
    [0.1832]    [-1.0298]    [0.9492]    [0.3071]    [0.1352]
  Columns 206 through 209
    [0.5152]    [0.2614]    [-0.9415]    [-0.1623]
  Columns 210 through 213
    [-0.1461]    [-0.5320]    [1.6821]    [-0.8757]
  Columns 214 through 217
    [-0.4838]    [-0.7120]    [-1.1742]    [-0.1922]
  Columns 218 through 221
    [-0.2741]    [1.5301]    [-0.2490]    [-1.0642]
  Columns 222 through 225
    [1.6035]    [1.2347]    [-0.2296]    [-1.5062]
  Columns 226 through 229
    [-0.4446]    [-0.1559]    [0.2761]    [-0.2612]
  Columns 230 through 233
    [0.4434]    [0.3919]    [-1.2507]    [-0.9480]
  Columns 234 through 237
    [-0.7411]    [-0.5078]    [-0.3206]    [0.0125]
  Columns 238 through 241
    [-3.0292]    [-0.4570]    [1.2424]    [-1.0667]
  Columns 242 through 245
    [0.9337]    [0.3503]    [-0.0290]    [0.1825]
  Columns 246 through 249
    [-1.5651]    [-0.0845]    [1.6039]    [0.0983]
  Columns 250 through 253
    [0.0414]    [-0.7342]    [-0.0308]    [0.2323]
  Columns 254 through 257
    [0.4264]    [-0.3728]    [-0.2365]    [2.0237]
  Columns 258 through 261
    [-2.2584]    [2.2294]    [0.3376]    [1.0001]
  Columns 262 through 265
    [-1.6642]    [-0.5900]    [-0.2781]    [0.4227]
  Columns 266 through 269
    [-1.6702]    [0.4716]    [-1.2128]    [0.0662]
  Columns 270 through 274
    [0.6524]    [0.3271]    [1.0826]    [1.0061]    [-0.6509]
  Columns 275 through 278
    [0.2571]    [-0.9444]    [-1.3218]    [0.9248]
  Columns 279 through 282
    [4.9849e-05]    [-0.0549]    [0.9111]    [0.5946]
  Columns 283 through 287
    [0.3502]    [1.2503]    [0.9298]    [0.2398]    [-0.6904]
  Columns 288 through 291
    [-0.6516]    [1.1921]    [-1.6118]    [-0.0245]
  Columns 292 through 295
    [-1.9488]    [1.0205]    [0.8617]    [0.0012]
  Columns 296 through 299
    [-0.0708]    [-2.4863]    [0.5812]    [-2.1924]
  Columns 300 through 303
    [-2.3193]    [0.0799]    [-0.9485]    [0.4115]
  Columns 304 through 308
    [0.6770]    [0.8577]    [-0.6912]    [0.4494]    [0.1006]
  Columns 309 through 312
    [0.8261]    [0.5362]    [0.8979]    [-0.1319]
  Columns 313 through 316
    [-0.1472]    [1.0078]    [-2.1237]    [-0.5046]
  Columns 317 through 320
    [-1.2706]    [-0.3826]    [0.6487]    [0.8257]
  Columns 321 through 324
    [-1.0149]    [-0.4711]    [0.1370]    [-0.2919]
  Columns 325 through 328
    [0.3018]    [0.3999]    [-0.9300]    [-0.1768]
  Columns 329 through 332
    [-2.1321]    [1.1454]    [-0.6291]    [-1.2038]
  Columns 333 through 336
    [-0.2539]    [-1.4286]    [-0.0209]    [-0.5607]
  Columns 337 through 340
    [2.1778]    [1.1385]    [-2.4969]    [0.4413]
  Columns 341 through 344
    [-1.3981]    [-0.2551]    [0.1644]    [0.7477]
  Columns 345 through 348
    [-0.2730]    [1.5763]    [-0.4809]    [0.3275]
  Columns 349 through 353
    [0.6647]    [0.0852]    [0.8810]    [0.3232]    [-0.7841]
  Columns 354 through 357
    [-1.8054]    [1.8586]    [-0.6045]    [0.1034]
  Columns 358 through 361
    [0.5632]    [0.1136]    [-0.9047]    [-0.4677]
  Columns 362 through 365
    [-0.1249]    [1.4790]    [-0.8608]    [0.7847]
  Columns 366 through 369
    [0.3086]    [-0.2339]    [-1.0570]    [-0.2841]
  Columns 370 through 373
    [-0.0867]    [-1.4694]    [0.1922]    [-0.8223]
  Columns 374 through 377
    [-0.0942]    [0.3362]    [-0.9047]    [-0.2883]
  Columns 378 through 382
    [0.3501]    [-1.8359]    [1.0360]    [2.4245]    [0.9594]
  Columns 383 through 386
    [-0.3158]    [0.4286]    [-1.0360]    [1.8779]
  Columns 387 through 390
    [0.9407]    [0.7873]    [-0.8759]    [0.3199]
  Columns 391 through 394
    [-0.5583]    [-0.3114]    [-0.5700]    [-1.0257]
  Columns 395 through 398
    [-0.9087]    [-0.2099]    [-1.6989]    [0.6076]
  Columns 399 through 402
    [-0.1178]    [0.6992]    [0.2696]    [0.4943]
  Columns 403 through 406
    [-1.4831]    [-1.0203]    [-0.4470]    [0.1097]
  Columns 407 through 411
    [1.1287]    [-0.2900]    [1.2616]    [0.4754]    [1.1741]
  Columns 412 through 415
    [0.1269]    [-0.6568]    [-1.4814]    [0.1555]
  Columns 416 through 419
    [0.8186]    [-0.2926]    [-0.5408]    [-0.3086]
  Columns 420 through 423
    [-1.0966]    [-0.4930]    [-0.1807]    [0.0458]
  Columns 424 through 428
    [-0.0638]    [0.6113]    [0.1093]    [1.8140]    [0.3120]
  Columns 429 through 432
    [1.8045]    [-0.7231]    [0.5265]    [-0.2603]
  Columns 433 through 436
    [0.6001]    [0.5939]    [-2.1860]    [-1.3270]
  Columns 437 through 440
    [-1.4410]    [0.4018]    [1.4702]    [-0.3268]
  Columns 441 through 444
    [0.8123]    [0.5455]    [-1.0516]    [0.3975]
  Columns 445 through 448
    [-0.7519]    [1.5163]    [-0.0326]    [1.6360]
  Columns 449 through 452
    [-0.4251]    [0.5894]    [-0.0628]    [-2.0220]
  Columns 453 through 456
    [-0.9821]    [0.6125]    [-0.0549]    [-1.1187]
  Columns 457 through 460
    [-0.6264]    [0.2495]    [-0.9930]    [0.9750]
  Columns 461 through 464
    [-0.6407]    [1.8089]    [-1.0799]    [0.1992]
  Columns 465 through 468
    [-1.5210]    [-0.7236]    [-0.5933]    [0.4013]
  Columns 469 through 473
    [0.9421]    [0.3005]    [-0.3731]    [0.8155]    [0.7989]
  Columns 474 through 478
    [0.1202]    [0.5712]    [0.4128]    [-0.9870]    [0.7596]
  Columns 479 through 482
    [-0.6572]    [-0.6039]    [0.1769]    [-0.3075]
  Columns 483 through 486
    [-0.1318]    [0.5954]    [1.0468]    [-0.1980]
  Columns 487 through 490
    [0.3277]    [-0.2383]    [0.2296]    [0.4400]
  Columns 491 through 495
    [-0.6169]    [0.2748]    [0.6011]    [0.0923]    [1.7298]
  Columns 496 through 499
    [-0.6086]    [-0.7371]    [-1.7499]    [0.9105]
  Columns 500 through 504
    [0.8671]    [-0.0799]    [0.8985]    [0.1837]    [0.2908]
  Columns 505 through 509
    [0.1129]    [0.4400]    [0.1017]    [2.7873]    [-1.1667]
  Columns 510 through 513
    [-1.8543]    [-1.1407]    [-1.0933]    [-0.4336]
  Columns 514 through 517
    [-0.1685]    [-0.2185]    [0.5413]    [0.3893]
  Columns 518 through 521
    [0.7512]    [1.7783]    [1.2231]    [-1.2833]
  Columns 522 through 525
    [-2.3290]    [0.9019]    [-1.8356]    [0.0668]
  Columns 526 through 529
    [0.0355]    [2.2272]    [-0.0692]    ...