L18post

# L18post - Previous Lecture Characters and strings Todays...

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

± Previous Lecture: ± Characters and strings ± Today’s Lecture: ± Cell arrays ± Announcement: ± Project 5 due Thursday 10/5 at 11pm ± Prelim 2 on Nov 10. Email Randy Hess ( ) if you have a conflict.

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

View Full Document
October 29, 2009 Lecture 18 2 Example: toUpper Write a function toUpper(cha) to convert character cha to upper case if cha is a lower case letter. Return the converted letter. If cha is not a lower case letter, simply return the character cha . Hint : Think about the distance between a letter and the base letter ‘ a ’(or± A ’). E.g., a b c d e f g h … A B C D E F G H … Of course, do not use Matlab function upper ! distance
October 29, 2009 Lecture 18 3 Example: censoring words function C = censor(str, A) % Replace all occurrences of string str in % character matrix A with X’s, regardless of % case. % Assume str is never split across two lines. % C is A with X’s replacing str. A U s M A T L A B e i n t h a t l a b . U s M A T X X X e i n t h a t X X X . C c e n s o r l a b

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

View Full Document
October 29, 2009 Lecture 18 8 Matrix vs. Cell Array 3.1 2 -1 9 1.1 ‘c’ ‘o’ ‘m’ ‘’ ‘s’ ‘1’ ‘1’ ‘1’ ‘2’ ‘’ ‘’ ‘’ ‘L’ ‘A’ ‘B’ ‘M’ ‘a’ ‘t’ ‘’ ‘’ Vectors and matrices store
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 21

L18post - Previous Lecture Characters and strings Todays...

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

View Full Document
Ask a homework question - tutors are online