Cell Arrays(11/35) using the cell function The cell function allows you to preallocate empty cell arrays of the specified size. ■a=cell(m,n) Then you can use assignment statements to fill values in the cells Pitfalls Do not attempt to create a cell array with the same name as an existing numeric array. 同济大学 AW TONGJI UNIVERSITY
Cell Arrays(11/35) ✓ using the cell function ◼ The cell function allows you to preallocate empty cell arrays of the specified size. ◼ a = cell(m,n) ◼ Then you can use assignment statements to fill values in the cells Pitfalls : Do not attempt to create a cell array with the same name as an existing numeric array
Cell Arrays(12/35) ▣ using braces {as cell constructors b-{[12],17,[2;4],3-4i,hello',eye(3)} b= [1x2 double]17][2x1 double] [3.0000-4.0000i1]hello'[3x3 double Note that matlab displays the data structures in each element of a cell array in a condensed form. @月停大学 TONGJI UNIVERSITY
Cell Arrays(12/35) using braces { } as cell constructors b={[1 2],17,[2;4] ; 3-4i, 'hello', eye(3)} b = [1x2 double] [ 17] [2x1 double] [3.0000 - 4.0000i] 'hello' [3x3 double] Note that matlab displays the data structures in each element of a cell array in a condensed form
Cell Arrays(13/35) celldisp function displays the contents of the data structures in each cell celldisp(b) b{1,1}= b{2,2}= 12 hello b{2,1}= b{1,3}= 2 3.0000-4.0000i 4 b{1,2}= b{2,3}= 17 100 010 00 1 @日济大学 TONGJIUNIVERSITY
Cell Arrays(13/35) celldisp function displays the contents of the data structures in each cell ✓ celldisp(b) b{1,1} = 1 2 b{2,1} = 3.0000 - 4.0000i b{1,2} = 17 b{2,2} = hello b{1,3} = 2 4 b{2,3} = 1 0 0 0 1 0 0 0 1
Cell Arrays(14/35) cellplot(b) b= [1x2 double]17][2x1 double] [3.0000-4.0000i]'hello'3x3 double] helld CDHAW @月诱大学 TONGJI UNIVERSITY
Cell Arrays(14/35) cellplot(b) b = [1x2 double] [ 17] [2x1 double] [3.0000 - 4.0000i] 'hello' [3x3 double]