Filter löschen
Filter löschen

What does this mean?

4 Ansichten (letzte 30 Tage)
Nalini Nadupalli
Nalini Nadupalli am 12 Mär. 2014
Bearbeitet: James Tursa am 13 Mär. 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

Antworten (1)

James Tursa
James Tursa am 13 Mär. 2014
Bearbeitet: James Tursa am 13 Mär. 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.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by