Cody

# Problem 42783. Accessing values in a cell

Solution 2883671

Submitted on 27 Aug 2020 by Ramesh Kumar V
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
format compact c=cell(1,3); c{1}=2:6;c{2}=7:12;c{3}=13:18; a=[1 2 3];b=[4 5 6]; y_correct = [5 11 18]; assert(isequal(break_cells_down(c,a,b),y_correct))

y = 5 y = 5 11 y = 5 11 18

2   Pass
clear c c=cell(1,5); c{1}=rand(1,10); c{2}=rand(1,10); c{3}=rand(1,10); c{4}=rand(1,10); c{5}=rand(1,10); a=randperm(5) b=randperm(10); b=b(1:5) y_correct=[c{a(1)}(b(1)) c{a(2)}(b(2)) c{a(3)}(b(3)) c{a(4)}(b(4)) c{a(5)}(b(5))] assert(isequal(break_cells_down(c,a,b),y_correct))

a = 3 2 4 5 1 b = 3 4 1 2 9 y_correct = 0.1162 0.6331 0.4981 0.7971 0.1951 y = 0.1162 y = 0.1162 0.6331 y = 0.1162 0.6331 0.4981 y = 0.1162 0.6331 0.4981 0.7971 y = 0.1162 0.6331 0.4981 0.7971 0.1951

3   Pass
clear c c=cell(1,6); c{1}=1:6; c{2}=1:6; c{3}=1:6; c{4}=1:6; c{5}=1:6; c{6}=1:6; a=1:6; b=randperm(6) y_correct=b; assert(isequal(break_cells_down(c,a,b),y_correct))

b = 3 2 4 5 6 1 y = 3 y = 3 2 y = 3 2 4 y = 3 2 4 5 y = 3 2 4 5 6 y = 3 2 4 5 6 1

### Community Treasure Hunt

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

Start Hunting!