Cody

Problem 44721. Seperate array to small section according to its index position

Solution 3779598

Submitted on 22 Nov 2020
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   Fail
for n = 3 : 12 y = odd_and_even_fun(n); while length(y) ~= 1 y = cellfun(@(x)x(:)',mat2cell(cell2mat(reshape(y,2,'')),2,repelem(numel(y{1}),length(y)/2)),'uni',0); end assert(isequal(y{1},0:2^n-1)) end

Error using mat2cell (line 89) Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [2 8]. Error in Test1 (line 4) y = cellfun(@(x)x(:)',mat2cell(cell2mat(reshape(y,2,'')),2,repelem(numel(y{1}),length(y)/2)),'uni',0);

Suggested Problems

More from this Author17

Community Treasure Hunt

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

Start Hunting!