Borrar filtros
Borrar filtros

What does this mean?

4 visualizaciones (últimos 30 días)
Nalini Nadupalli
Nalini Nadupalli el 12 de Mzo. de 2014
Editada: James Tursa el 13 de Mzo. de 2014
I defined a Cell array as following
C =
'one' 'two' 'three'
[ 1] [ 2] [ 45]
Change 1: Changed the values of the 2nd row as follows >> C(2,:)={{1,2},{3,4},{5,6}}
and Got
C =
'one' 'two' 'three'
{1x2 cell} {1x2 cell} {1x2 cell}
Change 2: if I changed the values as the following
>> C(2,:)={[1,2],[3,4],[5,6]}
C =
'one' 'two' 'three'
[1x2 double] [1x2 double] [1x2 double]
Can someone please explain what is the difference between the results of change 1 and change 2?
Thanks a lot in advance

Respuestas (1)

James Tursa
James Tursa el 13 de Mzo. de 2014
Editada: James Tursa el 13 de Mzo. de 2014
Change 1:
Each element of the 2nd row is a cell array. And each of those cell arrays has two elements (1x2 dimension). Each of those two elements is in and of itself a MATLAB double variable. The way you have constructed it, you have six separate double variables, [1], [2], [3], [4], [5], [6], that are stored inside of three cell arrays that are themselves stored inside of a single cell array.
Change 2:
Each element of the 2nd row is a double array. And each of those doubles arrays has two elements (1x2 dimension). The way you have constructed it, you have three separate double variables (each 1x2), [1 2], [3 4], [5 6], that are stored inside of a single cell array.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by