L1 - Cell and Structure Arrays A cell array is an array in...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Cell and Structure Arrays A cell array is an array in which each element is a bin , or cell , which can contain an array. You can store different classes of arrays in a cell array, and you can group data sets that are related but have different dimensions. You access cell arrays using the same indexing operations used with ordinary arrays. You can create a cell array by using assignment statements or by using cell function. We will look at the latter first. Function Description C = cell(n) Creates an n x n cell array C of empty matrices C = cell(n,m) Creates an n x m cell array C of empty matrices celldisp(C) Displays the contents of cell array C cellplot(C) Displays the graphical representation of the cell array C C = num2cell(A) Converts a numeric array A into a cell array C [X,Y, ] = deal(A,B, ) Matches up the input and output lists. Equivalent to X = A,Y = B, [X,Y, ] = deal(A) Matches up the input and output lists. Equivalent to X = A,Y = A, iscell(C) Returns a 1 if C is a cell array; otherwise, returns a 0. >> A(1,1)={'Walden Pond}; >> A(1,2)={June 13, 1997}; >> A(2,1)={[60,72,65]}; >> A(2,2)={[55,57,56;54,56,55;52,55,53]}; >> A A = 'Walden Pond' 'June 13, 1997' [1x3 double] [3x3 double] Type celldisp(A) sing Cell Indexing A{1,1} = Walden Pond A{2,1} = 60 72 65 A{1,2} = June 13, 1997 A{2,2} = 55 57 56 54 56 55 52 55 53 >> A{1,1}='Walden Pond'; >> A{1,2}='June 13, 1997'; >> A{2,1}=[60,72,65]; >> A{2,2}=[55,57,56;54,56,55;52,55,53]; >> A A = 'Walden Pond' 'June 13, 1997' [1x3 double] [3x3 double] Walden Pond June 13, 1997 Type cellplot(A) sing Content Indexing and the celldisp function >> B={[2,4], [6,-9;3,5]; [7;2], 10}; >> disp(B) [1x2 double] [2x2 double] [2x1 double] [ 10] >> B B = [1x2 double] [2x2 double] [2x1 double]...
View Full Document

This note was uploaded on 06/22/2009 for the course INT. COMPU 14:440:127 taught by Professor Crawford during the Spring '09 term at Rutgers.

Page1 / 11

L1 - Cell and Structure Arrays A cell array is an array in...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online