creating a cell arraythe other method of creating


Creating a cell array:

The other method of creating a cell array is easy to assign values to particular array elements and build it up element by element. Though, as explained before, expanding an array element by element is a very ineffective and time-consuming technique. It is much more efficient, if the size is known ahead of time, to preallocate the array. For the cell arrays, this is completed with the cell function. For illustration, to preallocate a variable mycellmat to be a 2 × 2 cell array, the cell function would be called as shown below:

>> mycellmat = cell(2,2)

mycellmat =

[]  []

[]  []

Note that this is a function call; therefore the arguments to the function are in parentheses. This generates a matrix in which all the elements are empty vectors. Then, each and every element can be replaced by the desired value.

 

 

 

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: creating a cell arraythe other method of creating
Reference No:- TGS0175095

Expected delivery within 24 Hours