CS 100 M Lecture 14

CS 100 M Lecture 14 - 14. Cell Arrays Set-Up Subscripting...

This preview shows pages 1–12. Sign up to view the full content.

14. Cell Arrays Set-Up Subscripting Nested Loops String Manipulations

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

View Full Document
A Small Cell Array… C = { ‘Alabama’,’New York’,’Utah’}; C: ‘Alabama’ ‘New York’ ‘Utah’
Syntax C = { ‘Alabama’,’New York’,’Utah’}; Curly Brackets Entries Separated by Commas

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

View Full Document
Synonym C = { ‘Alabama’,’New York’,’Utah’}; C = cell(1,3); C{1} = ‘Alabama’; C{2} = ‘New York’; C{3} = ‘Utah’; Application: Storing strings
“Vertical” Cell Array Set-up C = { ‘Alabama’;’New York’;’Utah’}; C = cell(3,1); C{1} = ‘Alabama’; C{2} = ‘New York’; C{3} = ‘Utah’; Application: Storing strings

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

View Full Document
Another Small Cell Array… C = { [1 2 3],[10;20], zeros(1,4)}; C: [1 2 3] [10;20] zeros(1,4)
Syntax C = { [1 2 3], [10;20], zeros(1,4)}; Curly Brackets Entries Separated by Commas

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

View Full Document
Synonym C = cell(1,3); C{1} = [1 2 3]; C{2} = [10;20]; C{3} = zeros(1,4); Application: Storing a Set of Arrays C = { [1 2 3], [10;20], zeros(1,4)};
Problem: Set Up a Card Deck

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

View Full Document
Idea… A{1} = ‘A Hearts’; A{2} = ‘2 Hearts’; : A{13} = ‘K Hearts’; A{14} = ‘A Clubs’; : A{52} = ‘K Diamonds’;
Initializations… suit = {‘Hearts’, ‘Clubs’, … ‘Spades’, ‘Diamonds’}; rank = {‘A’,‘2’,’3’,’4’,’5’,’6’,… ’7’,’8’,’9’,’10’,’J’,’Q’,’K’}; A = cell(1,52);

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/23/2008 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell.

Page1 / 45

CS 100 M Lecture 14 - 14. Cell Arrays Set-Up Subscripting...

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

View Full Document
Ask a homework question - tutors are online