Cody

Solution 1998549

Submitted on 1 Nov 2019 by Nikolaos Nikolaou
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}))

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

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

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

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

y = 1×45 cell array Columns 1 through 12 {[0.8373]} {[0.8169]} {[0.4234]} {[0.2360]} {[0.4556]} {[0.2519]} {[0.6148]} {[0.8909]} {[0.8237]} {[0.6211]} {[0.7200]} {[0.5319]} Columns 13 through 24 {[0.6435]} {[0.4810]} {[0.8021]} {[0.1129]} {[0.3041]} {[0.0477]} {[0.4874]} {[0.9699]} {[0.4569]} {[0.6572]} {[0.5553]} {[0.1750]} Columns 25 through 36 {[0.6171]} {[0.8640]} {[0.8345]} {[0.9333]} {[0.5322]} {[0.4433]} {[0.6732]} {[0.2586]} {[0.8142]} {[0.5368]} {[0.1454]} {[0.5843]} Columns 37 through 45 {[0.3923]} {[0.0705]} {[0.3155]} {[0.3456]} {[0.1862]} {[0.0514]} {[0.1383]} {[0.2505]} {[0.7256]} y = 1×87 cell array Columns 1 through 12 {[0.9550]} {[0.0578]} {[0.0867]} {[0.3290]} {[0.7927]} {[0.3970]} {[0.3925]} {[0.5710]} {[0.4496]} {[0.8565]} {[0.0511]} {[0.9197]} Columns 13 through 24 {[0.2527]} {[0.4109]} {[0.4721]} {[0.6382]} {[0.9607]} {[0.4334]} {[0.3476]} {[0.3265]} {[0.7750]} {[0.1584]} {[0.2119]} {[0.5534]} Columns 25 through 36 {[0.6641]} {[0.7462]} {[0.4490]} {[0.2335]} {[0.1537]} {[0.3830]} {[0.7365]} {[0.2832]} {[0.5232]} {[0.7366]} {[0.6219]} {[0.1840]} Columns 37 through 48 {[0.0472]} {[0.6827]} {[0.2904]} {[0.0127]} {[0.0547]} {[0.5673]} {[0.0111]} {[0.4297]} {[0.0561]} {[0.6935]} {[0.7480]} {[0.0378]} Columns 49 through 60 {[0.2963]} {[0.7083]} {[0.4122]} {[0.3394]} {[0.0215]} {[0.0619]} {[0.6401]} {[0.3226]} {[0.3053]} {[0.8692]} {[0.5021]} {[0.0689]} Columns 61 through 72 {[0.1634]} {[0.5260]} {[0.0973]} {[0.9294]} {[0.8371]} {[0.5839]} {[0.9572]} {[0.2957]} {[0.3319]} {[0.9167]} {[0.5692]} {[0.4426]} Columns 73 through 84 {[0.5410]} {[0.6889]} {[0.8346]} {[0.5240]} {[0.3936]} {[0.9765]} {[0.4871]} {[0.9050]} {[0.7384]} {[0.0306]} {[0.1863]} {[0.9250]} Columns 85 through 87 {[0.7942]} {[0.4550]} {[0.4219]} y = 1×11 cell array {[0.8649]} {[0.1105]} {[0.5431]} {[0.0485]} {[0.1001]} {[0.4065]} {[0.3313]} {[0.2768]} {[0.0171]} {[0.7087]} {[0.1037]} y = 1×54 cell array Columns 1 through 12 {[0.4745]} {[0.8776]} {[0.5504]} {[0.0323]} {[0.4026]} {[0.7035]} {[0.0273]} {[0.0356]} {[0.3537]} {[0.3808]} {[0.2310]} {[0.7810]} Columns 13 through 24 {[0.9089]} {[0.9277]} {[0.5221]} {[0.4214]} {[0.9671]} {[0.5968]} {[0.7959]} {[0.1162]} {[0.3636]} {[0.5853]} {[0.3395]} {[0.8838]} Columns 25 through 36 {[0.5630]} {[0.1455]} {[0.8650]} {[0.1237]} {[0.2818]} {[0.1070]} {[0.6320]} {[0.4521]} {[0.9184]} {[0.4294]} {[0.5173]} {[0.0422]} Columns 37 through 48 {[0.4529]} {[9.9468e-04]} {[0.8934]} {[0.5216]} {[0.2767]} {[0.9473]} {[0.2340]} {[0.6182]} {[0.0457]} {[0.6588]} {[0.1984]} {[0.7054]} Columns 49 through 54 {[0.2524]} {[0.6492]} {[0.8109]} {[0.8052]} {[0.6515]} {[0.0676]} y = 1×61 cell array Columns 1 through 12 {[0.6775]} {[0.0794]} {[0.3389]} {[0.7320]} {[0.1619]} {[0.7962]} {[0.1476]} {[0.5483]} {[0.0392]} {[0.6953]} {[0.6120]} {[0.1143]} Columns 13 through 24 {[0.5247]} {[0.8165]} {[0.3859]} {[0.9657]} {[0.7377]} {[0.7489]} {[0.4410]} {[0.0081]} {[0.5309]} {[0.5565]} {[0.2021]} {[0.9940]} Columns 25 through 36 {[0.5754]} {[0.3911]} {[0.9294]} {[0.4044]} {[0.1842]} {[0.4550]} {[0.0164]} {[0.1268]} {[0.8114]} {[0.6090]} {[0.8792]} {[0.2447]} Columns 37 through 48 {[0.8224]} {[0.9108]} {[0.1579]} {[0.7403]} {[0.1723]} {[0.7847]} {[0.5075]} {[0.8258]} {[0.4594]} {[0.4394]} {[0.8624]} {[0.6328]} Columns 49 through 60 {[0.5105]} {[0.3830]} {[0.4249]} {[0.4253]} {[0.5900]} {[0.2694]} {[0.7677]} {[0.5818]} {[0.8117]} {[0.7932]} {[0.5537]} {[0.3969]} Column 61 {[0.9890]} y = 1×62 cell array Columns 1 through 12 {[0.8325]} {[0.4234]} {[0.0593]} {[0.0015]} {[0.8752]} {[0.0068]} {[0.2976]} {[0.4178]} {[0.3205]} {[0.3980]} {[0.3840]} {[0.2632]} Columns 13 through 24 {[0.5828]} {[0.9255]} {[0.5037]} {[0.7492]} {[0.4252]} {[0.3923]} {[0.7477]} {[0.4549]} {[0.8722]} {[0.4704]} {[0.0676]} {[0.6875]} Columns 25 through 36 {[0.6948]} {[0.4952]} {[0.1190]} {[0.2015]} {[0.9844]} {[0.7478]} {[0.0013]} {[0.6233]} {[0.6718]} {[0.6829]} {[0.9754]} {[0.4948]} Columns 37 through 48 {[0.8409]} {[0.3579]} {[0.6828]} {[0.9146]} {[0.3648]} {[0.8351]} {[0.1838]} {[0.3927]} {[0.6747]} {[0.2714]} {[0.4538]} {[0.5120]} Columns 49 through 60 {[0.3491]} {[0.9251]} {[0.2128]} {[0.2897]} {[0.7377]} {[0.4223]} {[0.2086]} {[0.6960]} {[0.4830]} {[0.5255]} {[0.3687]} {[0.2242]} Columns 61 through 62 {[0.1596]} {[0.1099]} y = 1×73 cell array Columns 1 through 12 {[0.5684]} {[0.5087]} {[0.8884]} {[0.7760]} {[0.1199]} {[0.6370]} {[0.8767]} {[0.6283]} {[0.7669]} {[0.7278]} {[0.8034]} {[0.5509]} Columns 13 through 24 {[0.3851]} {[0.4972]} {[0.8078]} {[0.2813]} {[0.7381]} {[0.3244]} {[0.6091]} {[0.5635]} {[0.9851]} {[0.5200]} {[0.9078]} {[0.3462]} Columns 25 through 36 {[0.6264]} {[0.3392]} {[0.8438]} {[0.1089]} {[0.2595]} {[0.9001]} {[0.0643]} {[0.8636]} {[0.5700]} {[0.4135]} {[0.1899]} {[0.3653]} Columns 37 through 48 {[0.4592]} {[0.8907]} {[0.0759]} {[0.4765]} {[0.2687]} {[0.4892]} {[0.6039]} {[0.1225]} {[0.3621]} {[0.7049]} {[0.3808]} {[0.0752]} Columns 49 through 60 {[0.6323]} {[0.3561]} {[0.8461]} {[0.5810]} {[0.3079]} {[0.2307]} {[0.1132]} {[0.4317]} {[0.1913]} {[0.7720]} {[0.5488]} {[0.7278]} Columns 61 through 72 {[0.2253]} {[0.6271]} {[0.1197]} {[0.3977]} {[0.5355]} {[0.3135]} {[0.9572]} {[0.9897]} {[0.0327]} {[0.4777]} {[0.0989]} {[0.5723]} Column 73 {[0.6900]} y = 1×59 cell array Columns 1 through 12 {[0.4869]} {[0.7817]} {[0.6583]} {[0.5000]} {[0.1198]} {[0.5337]} {[0.0200]} {[0.3986]} {[0.4870]} {[0.6085]} {[0.6968]} {[0.9665]} Columns 13 through 24 {[0.7789]} {[0.4729]} {[0.2809]} {[0.4546]} {[0.7824]} {[0.3255]} {[0.4791]} {[0.9821]} {[0.7926]} {[0.5457]} {[0.9827]} {[0.4256]} Columns 25 through 36 {[0.1732]} {[0.0170]} {[0.4888]} {[0.4919]} {[0.1286]} {[0.8222]} {[0.9274]} {[0.2073]} {[0.5583]} {[0.9295]} {[0.4741]} {[0.8878]} Columns 37 through 48 {[0.1147]} {[0.2479]} {[0.9067]} {[0.0102]} {[0.3791]} {[0.2190]} {[0.7153]} {[0.6496]} {[0.9123]} {[0.3995]} {[0.1783]} {[0.9848]} Columns 49 through 59 {[0.0070]} {[0.2025]} {[0.3769]} {[0.2432]} {[0.5038]} {[0.1040]} {[0.8292]} {[0.7297]} {[0.0477]} {[0.1598]} {[0.4187]} y = 1×100 cell array Columns 1 through 12 {[0.8448]} {[0.5369]} {[0.2440]} {[0.5020]} {[0.7914]} {[0.7158]} {[0.2111]} {[0.8817]} {[0.1710]} {[0.7418]} {[0.6843]} {[0.5356]} Columns 13 through 24 {[0.5469]} {[0.5810]} {[0.3553]} {[0.3049]} {[0.6560]} {[0.0508]} {[0.6154]} {[0.0624]} {[0.6260]} {[0.5720]} {[0.6524]} {[0.8774]} Columns 25 through 36 {[0.1123]} {[0.7363]} {[0.7387]} {[0.2698]} {[0.8841]} {[0.5802]} {[0.6370]} {[0.2987]} {[0.2575]} {[0.8051]} {[0.6638]} {[0.8761]} Columns 37 through 48 {[0.8591]} {[0.5752]} {[0.4330]} {[0.1637]} {[0.2315]} {[0.6866]} {[0.0665]} {[0.6315]} {[0.2814]} {[0.8586]} {[0.8611]} {[0.1240]} Columns 49 through 60 {[0.9195]} {[0.4244]} {[0.9233]} {[0.5842]} {[0.1509]} {[0.9833]} {[0.2122]} {[0.1337]} {[0.8348]} {[0.4518]} {[0.6429]} {[0.2655]} Columns 61 through 72 {[0.0465]} {[0.4717]} {[0.7281]} {[0.6298]} {[0.1979]} {[0.7254]} {[0.0406]} {[0.0270]} {[0.0854]} {[0.9787]} {[0.3593]} {[0.7616]} Columns 73 through 84 {[0.4163]} {[0.5531]} {[0.3399]} {[0.4473]} {[0.3725]} {[0.8794]} {[0.9425]} {[0.7679]} {[0.9037]} {[0.6602]} {[0.0821]} {[0.7062]} Columns 85 through 96 {[0.0167]} {[0.9207]} {[0.4050]} {[0.1760]} {[0.4267]} {[0.4381]} {[0.1181]} {[0.0831]} {[0.6429]} {[0.5406]} {[0.7707]} {[0.9556]} Columns 97 through 100 {[0.2485]} {[0.7343]} {[0.8141]} {[0.4258]} y = 1×14 cell array Columns 1 through 12 {[0.2814]} {[0.9641]} {[0.2762]} {[0.3037]} {[0.9747]} {[0.3115]} {[0.2018]} {[0.4852]} {[0.7543]} {[0.9641]} {[0.7132]} {[0.4063]} Columns 13 through 14 {[0.8009]} {[0.2973]}

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

y = 100×1 cell array {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double} {10×10 double}