creating cell arraysthere are many ways to create


Creating Cell arrays:

There are many ways to create cell arrays. For illustration, we will create a cell array in which one element will store an integer, one element store character, one element store vector, and one element will store a string. Just as with the arrays, this could be a 1 × 4 row vector, a 4 × 1 column vector, or a 2 × 2 matrix. The syntax for generating vectors and matrices are same. The values within rows are separated by spaces or commas, and rows are separated by the semicolons. Though, for cell arrays, curly braces are used instead of square brackets. For illustration, the following creates a row vector cell array with the four distinct values:

>> cellrowvec = {23, 'a', 1:2:9, 'hello'}

cellrowvec =

  [23]  'a'  [1x5 double]   'hello'

To generate a column vector cell array, the values are rather separated by semicolons:

>> cellcolvec = {23; 'a'; 1:2:9; 'hello'}

cellcolvec =

[  23]

'a'

[1x5 double]

'hello'

This technique creates a 2 × 2 cell array matrix:

>> cellmat = {23 'a'; 1:2:9 'hello'}

cellmat =

[  23]         'a'

[1x5 double]   'hello'

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: creating cell arraysthere are many ways to create
Reference No:- TGS0175094

Expected delivery within 24 Hours