I am getting "cell array.png' cell array. Now I want to divide each cell equally to 20 partitions

# Can I divide a linear array by a number which larger than its size ?

1 view (last 30 days)

Show older comments

##### 2 Comments

Image Analyst
on 16 Mar 2019

### Answers (2)

KSSV
on 16 Mar 2019

You interpolate your data into your desired size and then reshape. Read about interp1.

Walter Roberson
on 16 Mar 2019

Next20 = @(V) ceil(length(V)/20) * 20;

Interp20 = @(V) interp1(V, linspace(1, length(V), Next20(V)));

Split20 = @(V) mat2cell(V, 1, 20*ones(1, length(V)/20));

new_cell = cellfun( @(V) Split20(Interp20(V)), cell_array, 'Uniform', 0);

##### 8 Comments

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!