{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 1-31 - HELPful for printing answers 2D Array of...

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

View Full Document Right Arrow Icon
Chapters 2, 3, 4, 5, 6, (input/output), 15 (interpolation [linear, etc.]), Half the questions are multiple choice, the remaining is fill in the blank. No trick questions Character Strings >>t = ‘How about this character string?’ t= How about this character string? >>size(t) Ans = 1 32 >>whos Name Size Bytes Class 1 1x32 64 char array Character String is text surrounded by single quotes Each character (including blank) is a single element in an array Each element occupies 2 bytes Representation Inside the computer, each character is represented by a binary code What is a character? o Alphabetical character Upper and lower case – (they are different) o Numerical character
Background image of page 1

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

View Full Document Right Arrow Icon
o Punctuation o Special symbols like $, #, @, !, etc. ASCII Codes Page B2? Array operations >>u = t(16:24) U = Character >>u = t(24:-1:16) u = retcarahc >>u = ‘I love’ >>v = ‘UC Davis’ >>w = [u v] W = I love UC Davis
Background image of page 2
Background image of page 3

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

View Full Document Right Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: --- HELPful for printing answers 2D Array of String • To do this we use cell arrays • This is example of cell array >>carr = {‘first name’; ‘last name’; ‘hometown’} Carr= ‘first name’ ‘last name’ ‘hometown’ *Note curly braces instead of the square brackets. Cell arrays are discussed in detail later. * putting spaces in between to increase the length of a vector Functions • Function int2ste rounds it arguments Casting • The difference between 65 and ‘6 and 5’ (ie 65 dollars, or 11 dollars) MATLAB Implementation of Casting >> uint8(‘A’) Ans= 65 >>char (100) Ans = d >> char([97 98 99 100 101]) Ans = abcde >>double(‘fred’) Ans = 102 114 101 100 >>fred = ‘Fred’ fred = Fred >>a = uint8(fred) a = 70 114 101 100 >>next = fred +1 next = 71 115 102 101 >>name = char(a+1) name = Gsfe...
View Full Document

{[ snackBarMessage ]}