Cody

# Problem 42593. Create cell array of numeric arrays

Solution 733842

Submitted on 11 Sep 2015 by James
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = rand; assert(isequal(cellnum(x),{x}))

y = [0.7439]

2   Pass
%% for ii=1:10 x = rand(1,randi([2 100])); assert(isequal(cellnum(x),{x})) end

y = [1x74 double] y = [1x8 double] y = [1x15 double] y = [1x5 double] y = [1x88 double] y = [1x38 double] y = [1x82 double] y = [1x22 double] y = [1x6 double] y = [1x34 double]

3   Pass
%% for ii=1:10 x = rand(randi([2 100]),1); assert(isequal(cellnum(x),{x})) end

y = [73x1 double] y = [11x1 double] y = [17x1 double] y = [41x1 double] y = [67x1 double] y = [85x1 double] y = [61x1 double] y = [44x1 double] y = [44x1 double] y = [23x1 double]

4   Pass
%% for ii=2:10 x = magic(ii); assert(isequal(cellnum(x),{x})) end

y = [2x2 double] y = [3x3 double] y = [4x4 double] y = [5x5 double] y = [6x6 double] y = [7x7 double] y = [8x8 double] y = [9x9 double] y = [10x10 double]

5   Pass
%% for ii=1:10 x = num2cell(rand(1,randi(100))); assert(isequal(cellnum(x),x)) end

y = Columns 1 through 8 [0.1262] [0.9655] [0.9519] [0.3196] [0.2472] [0.6164] [0.6342] [0.6413] Columns 9 through 16 [0.3263] [0.4544] [0.1535] [0.8993] [0.1225] [0.0705] [0.3219] [0.2722] Columns 17 through 24 [0.4595] [0.3273] [0.0172] [0.5587] [0.6022] [0.7801] [0.9421] [0.3688] Columns 25 through 32 [0.8036] [0.0713] [0.8210] [0.6972] [0.2325] [0.8168] [0.6321] [0.0736] Columns 33 through 40 [0.1145] [0.2452] [0.5031] [0.9523] [0.4941] [0.7375] [0.9077] [0.8049] Columns 41 through 48 [0.8557] [0.2785] [0.5485] [0.6496] [0.5570] [0.7915] [0.2937] [0.5473] Columns 49 through 56 [0.4355] [0.1924] [0.9662] [0.5516] [0.4556] [0.3030] [0.3605] [0.8829] Columns 57 through 64 [0.8257] [0.0425] [0.7813] [0.1147] [0.4316] [0.8423] [0.9858] [0.4757] Columns 65 through 70 [0.3948] [0.3314] [0.6281] [0.2734] [0.8607] [0.4696] y = [0.5209] [0.7059] [0.5669] [0.9201] [0.8206] [0.6484] y = Columns 1 through 8 [0.7657] [0.4740] [0.9998] [0.0117] [0.2616] [0.7892] [0.4197] [0.0944] Columns 9 through 10 [0.6659] [0.7680] y = Columns 1 through 8 [0.2871] [0.1683] [0.8960] [0.7970] [0.1573] [0.9235] [0.2586] [0.5718] Columns 9 through 16 [0.2526] [0.6536] [0.7899] [0.9056] [0.3008] [0.7903] [0.6882] [0.4173] Columns 17 through 24 [0.3090] [0.1714] [0.6352] [0.4562] [0.5544] [0.1239] [0.4999] [0.9741] Columns 25 through 30 [0.3877] [0.6715] [0.4185] [0.7551] [0.0605] [0.7545] y = Columns 1 through 8 [0.7551] [0.5270] [0.6242] [0.5077] [0.3832] [0.5731] [0.2973] [0.7795] Columns 9 through 16 [0.2259] [0.1471] [0.4373] [0.9116] [0.2698] [0.6827] [0.7859] [0.8268] Columns 17 through 24 [0.5670] [0.5338] [0.2300] [0.9769] [0.7304] [0.4445] [0.6332] [0.2430] Columns 25 through 32 [0.7684] [0.2257] [0.7564] [0.2607] [0.2259] [0.0715] [0.4027] [0.8168] Columns 33 through 40 [0.8349] [0.8570] [0.1054] [0.3874] [0.9688] [0.9481] [0.2374] [0.3334] Columns 41 through 48 [0.1942] [0.0641] [0.5745] [0.0747] [0.3659] [0.0101] [0.8361] [0.8884] Columns 49 through 56 [0.0076] [0.9208] [0.3498] [0.1183] [0.3138] [0.3909] [0.4659] [0.1397] Columns 57 through 64 [0.3514] [0.9821] [0.2535] [0.8866] [0.2196] [0.8792] [0.4221] [0.8769] Columns 65 through 72 [0.4293] [0.6328] [0.7726] [0.2719] [0.0958] [0.2219] [0.2506] [0.7449] Columns 73 through 80 [0.3816] [0.6913] [0.2273] [0.0571] [0.9300] [0.6016] [0.3686] [0.8765] Columns 81 through 88 [0.8181] [0.8805] [0.8902] [0.4899] [0.4855] [0.7197] [0.5143] [0.2644] Columns 89 through 91 [0.5853] [0.0051] [0.2688] y = Columns 1 through 8 [0.0546] [0.7720] [0.6391] [0.1451] [0.2095] [0.3475] [0.9944] [0.4503] Columns 9 through 16 [0.7141] [0.1713] [0.7746] [0.3706] [0.1234] [0.9395] [0.0309] [0.9005] Columns 17 through 24 [0.7436] [0.5158] [0.6182] [0.9453] [0.4822] [0.8315] [0.3063] [0.6001] Columns 25 through 32 [0.2936] [0.7920] [0.3129] [0.4225] [0.0997] [0.1409] [0.1206] [0.4695] Columns 33 through 40 [0.2573] [0.7732] [0.1478] [0.5956] [0.5513] [0.2323] [0.1757] [0.7283] Columns 41 through 48 [0.4273] [0.2118] [0.1771] [0.6949] [0.5689] [0.0195] [0.6591] [0.5868] Columns 49 through 56 [0.0440] [0.3738] [0.5256] [0.1911] [0.3027] [0.7293] [0.9830] [0.7442] Columns 57 through 64 [0.7195] [0.8633] [0.3399] [0.0482] [0.3150] [0.6353] [0.1833] [0.1857] Columns 65 through 72 [0.1298] [0.4245] [0.4177] [0.4224] [0.6041] [0.4350] [0.4574] [0.1022] Columns 73 through 80 [0.6148] [0.8941] [0.9904] [0.1681] [0.0703] [0.6822] [0.1730] [0.6474] Columns 81 through 85 [0.6723] [0.5044] [0.0100] [0.5210] [0.8000] y = Columns 1 through 8 [0.0497] [0.6747] [0.1420] [0.2789] [0.1723] [0.4506] [0.5579] [0.9117] Columns 9 through 16 [0.9074] [0.7659] [0.4620] [0.4655] [0.8658] [0.7030] [0.6400] [0.9243] Columns 17 through 24 [0.8817] [0.5436] [0.7647] [0.3414] [0.9967] [0.3852] [0.6075] [0.3437] Columns 25 through 32 [0.8755] [0.5043] [0.0503] [0.5512] [0.7215] [0.5682] [0.5543] [0.1727] Columns 33 through 40 [0.9619] [0.0193] [0.8591] [0.5378] [0.6777] [0.9814] [0.2911] [0.8709] Columns 41 through 48 [0.4683] [0.5942] [0.6916] [0.9706] [0.5224] [0.3238] [0.0014] [0.4721] Columns 49 through 56 [0.3944] [0.5776] [0.3646] [0.3715] [0.1208] [0.8321] [0.4167] [0.2623] Columns 57 through 64 [0.0464] [0.4281] [0.9988] [0.3825] [0.3863] [0.4623] [0.8905] [0.7053] Columns 65 through 72 [0.1351] [0.1279] [0.9757] [0.8922] [0.9758] [0.8471] [0.8022] [0.1982] Columns 73 through 80 [0.9722] [0.9585] [0.5065] [0.1257] [0.1891] [0.5418] [0.6196] [0.7779] Columns 81 through 83 [0.7213] [0.2405] [0.6655] y = Columns 1 through 8 [0.5608] [0.8553] [0.1740] [0.0650] [0.7663] [0.4194] [0.4417] [0.4712] Columns 9 through 14 [0.8926] [0.8582] [0.6386] [0.0532] [0.3032] [0.0855] y = Columns 1 through 8 [0.4659] [0.0966] [0.3176] [0.2667] [0.6131] [0.2621] [0.7753] [0.1070] Columns 9 through 16 [0.7666] [0.6048] [0.2069] [0.6489] [0.9672] [0.8232] [0.4634] [0.8475] Columns 17 through 24 [0.8620] [0.4597] [0.0276] [0.8175] [0.6056] [0.9722] [0.8835] [0.6156] Columns 25 through 28 [0.5310] [0.8072] [0.6767] [0.9976] y = Columns 1 through 8 [0.9822] [0.9605] [0.8719] [0.6843] [0.1710] [0.4085] [0.3596] [0.2430] Columns 9 through 16 [0.2937] [0.4054] [0.3905] [0.0895] [0.4837] [0.4696] [0.4294] [0.8457] Columns 17 through 24 [0.8612] [0.4440] [0.7218] [0.5472] [0.9495] [0.9794] [0.0563] [0.1168] Columns 25 through 31 [0.1362] [0.3112] [0.8794] [0.2835] [0.3718] [0.8369] [0.8558]

6   Pass
%% x = mat2cell(hankel(1:100),[10*ones(1,10)],[10*ones(1,10)]); assert(isequal(cellnum(x(:)),x(:)))

y = [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double] [10x10 double]