general computer science for engineers cisc 106 lecture 18 dr. john cavazos computer and information...

8
General Computer Science General Computer Science for Engineers for Engineers CISC 106 CISC 106 Lecture 18 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

Post on 22-Dec-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

General Computer General Computer Science Science

for Engineersfor EngineersCISC 106CISC 106

Lecture 18Lecture 18

Dr. John CavazosComputer and Information Sciences

3/27/2009

Page 2: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

Lecture OverviewLecture OverviewCell arrays (Section 7.2)Midterm 1

Page 3: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

What is a Cell Array?What is a Cell Array?A matrix that can contains in

each celldata of different types, sizes

and dimensionsA cell in a cell array can hold

a single element or an array of elements

Page 4: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

A Cell ArrayA Cell Array

Page 5: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

A Cell ArrayA Cell Array

Page 6: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

Cell Array SyntaxCell Array Syntaxc = cell(n) creates n-by-n empty cell array

c = cell (2)

c = [] [] [] []

Note: [] is an empty cell

Page 7: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

Cell Array SyntaxCell Array Syntaxc = cell(m, n) creates an m-by-n empty cell array. Arguments m and n must be scalars.

c = cell (2,3)

c = [] [] [] [] [] []

Page 8: General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009

Cell Array ExampleCell Array ExampleA = ones(2,2)

A = 1 1 1 1

c = cell(size(A))

c = [] [] [] []