Copying A Cell Array Or Parts Of Cell Array

In this tutorial,we are going to learn how to copy a cell array completely and also how to complete parts of cell array in Octave. This tutorial also applies to matlab. Cell array operations are similar to matrix operations. So I highly recommend you read the matrix manipulation operations tutorial before reading this. You can read that tutorial at

Let us make a cell array in Octave.

A = {'Number1' 'Number2'}



Let us copy the cell array A into a variable B. The way to do it is through the following syntax

B = A

(Note: You have to use paranthesis instead of curly braces {}. )



So that is how you copy a complete cell array into another variable. Let us learn how to copy parts of one cell array into another.

Let us redefine the variable A as follows

A = {'First row' 'First row'; 'Second row' 'Second row'}



Let us copy the first row of A into variable B. We can do this by using the following syntax

B = A(1,:)



You can extend this tutorial to copy mutiple rows and columns from a cell array.

This tutorial was inspired by an answer for a question at http://www.mathworks.com/matlabcentral/answers/22538-replicating-copy-part-of-cell-array.