MATLABŪ Getting Started Guide - The MathWorks - #151

/ 250


catalogue search
P. 151
P. 152
P. 153
P. 154
P. 155
P. 156
P. 157
P. 158
P. 159
P. 160
P. 161
P. 162
P. 163
P. 164
P. 165
P. 166
P. 167
P. 168
P. 169
P. 170
P. 171
P. 172
P. 173
P. 174
P. 175
P. 176
P. 177
P. 178
P. 179
P. 180
P. 181
P. 182
P. 183
P. 184
P. 185
P. 186
P. 187
P. 188
P. 189
P. 190
P. 191
P. 192
P. 193
P. 194
P. 195
P. 196
P. 197
P. 198
P. 199
P. 200


See other catalogues for The MathWorks

Text version of the page
Other Data Structures
is a 1-by-4-by-24 array containing 24 copies of the row vector
34 34 34 34 and
sum(M,2)
is a 4-by-1-by-24 array containing 24 copies ofthe column vector
34 34 34 34
Finally,
S = sum(M,3)
adds the 24 matrices in the sequence. The result has size 4-by-4-by-1, so it looks like a 4-by-4 array:
S =
204 204 204
204 204 204 204 204 204 204 204 204
204 204 204 204
Cell Arrays
Cell arrays in MATLAB are multidimensional arrays whose elements are copies of other arrays. A cell array of empty matrices can be created with the cell function. But, more often, cell arrays are created by enclosing a miscellaneous collection of things in curly braces, {}. The curly braces are also used with subscripts to access the contents ofvarious cells. For example,
C = {A sum(A) prod(prod(A))}
produces a 1-by-3 cell array. The three cells contain the magic square, the row vector of column sums, and the product of all its elements. When C is displayed, you see
C=
4-11

pageCatalog pdf di En 2012-06-22-01