lab8 - CS100M Lab Exercise 8 1 Cell array vs. vector You...

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

View Full Document Right Arrow Icon
CS100M Lab Exercise 8 1 Cell array vs. vector You already know that a vector is a collection of simple data. For example, you can have a vector of numbers (each cell stores a single number ) or a vector of characters (each cell stores a single character ). In a cell array, each cell can store an item that may be more complex than just a number or a character. Type the following code in the command window and observe the output and the display in the Workspace pane. Also read the comments given below. v= rand(1,4) % a VECTOR of length four, each cell stores ONE number v(3) % Notice that you use PARENTHESES to access a cell in a VECTOR c= cell(1,4) % Use built-in function CELL to create a CELL ARRAY. Note that its "class" in % the Workspace pane is "cell." Right now each cell is empty, therefore the % screen output shows four empty vectors. c{2}= v % Put a VECTOR in the 2nd cell of the CELL ARRAY. Notice that we use CURLY % BRACKETS to access a cell in a CELL ARRAY. c(3)= 1
Background image of page 1

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

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

This lab report was uploaded on 02/15/2008 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell University (Engineering School).

Page1 / 2

lab8 - CS100M Lab Exercise 8 1 Cell array vs. vector You...

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

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