What does this mean?

6 ビュー (過去 30 日間)
Nalini Nadupalli
Nalini Nadupalli 2014 年 3 月 12 日
編集済み: James Tursa 2014 年 3 月 13 日
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

回答 (1 件)

James Tursa
James Tursa 2014 年 3 月 13 日
編集済み: James Tursa 2014 年 3 月 13 日
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.

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by