MATLAB FINANCIAL DERIVATIVES TOOLBOX Uživatelský manuál Strana 88

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 119
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 87
87
“A =
[3x3 double] 'Anne Smith' []
[3.0000+ 7.0000i] [1x21 double] [ 5]
{2x1 cell } [] [2x2 double] ”
Content indexing
Enclose the cell subscripts in curly braces using standard array notation.
Specify the cell contents on the right side of the assignment statement [2].
For example:
A{1,1} = [1 4 3; 0 5 8; 7 2 9]; A{1,2} = 'Anne Smith';
A{2,1} = 3+7i; A{2,2} = -pi:pi/10:pi; A{2,3}=5;
G=cell(2,1); G{1,1}= [5 6 9]; G{2,1}='Hello World';
A{3,1} = G; A{3,3}=ones(2,2); ”
produces the same cell array as before.
If you assign data to a cell that is outside the dimensions of the current
array, Matlab automatically expands the array to include the subscripts you
specify. It fills any intervening cells with empty matrices. For example, the
assignment below turns the 3-by-3 cell array
A
A into a 3-by-4 cell array [2]
(note that the same holds for vectors and matrices with the only difference
that empty elements are assigned with zero values).
“A{3,4}='This expands the cell array';”
to get:
“A =
[3x3 double] 'Anne Smith' [] []
[3.0000+ 7.0000i] [1x21 double] [ 5] []
{2x1 cell } [] [2x2 double] [1x27 char]”
Zobrazit stránku 87
1 2 ... 83 84 85 86 87 88 89 90 91 92 93 ... 118 119

Komentáře k této Příručce

Žádné komentáře