Cody

Problem 42593. Create cell array of numeric arrays

Solution 1035747

Submitted on 28 Oct 2016 by Massimo Zanetti
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

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

Suggested Problems

More from this Author44

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!