09_stringFunctions - String Functions ENCMP 100 Overview 2...

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

View Full Document Right Arrow Icon
String Functions
Background image of page 1

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

View Full DocumentRight Arrow Icon
ENCMP 100 2 ©2011 by ECE, UofA Strings and String Functions Overview character codes: ASCII type char() in MATLAB 1D and 2D arrays removing white spaces from strings string functions: concatenate, compare, replace, find matching … “checking” string characters type conversion functions
Background image of page 2
ENCMP 100 3 ©2011 by ECE, UofA Introduction to Strings in MATLAB Computer programs are frequently required to handle text (e.g., screen output to human users, keyboard input from human users, human-readable stored data). MATLAB (like most programming languages) provides special functions to simplify the handling of strings. In a 64-bit PC, integers and floating-point numbers are represented using 64 bits (8 bytes) each. Characters are represented in MATLAB using 16 bits (2 bytes) each. A string is an array of characters. str = 'This is a dummy string'; Variable str is an array of char 's, of dimension 1x22, that occupies 44 bytes of memory. Strings and String Functions
Background image of page 3

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

View Full DocumentRight Arrow Icon
ENCMP 100 4 ©2011 by ECE, UofA Character Encodings Character codes are required to represent all of the required symbols in a human-readable language. In English, we need codes for at least the following: 26 upper case letters, 26 lower case letters, space character 10 decimal digits punctuation marks (e.g., !, ?, ', ", ;, :, etc.) Other codes are useful to have for text formatting, and to control input/output devices. linefeed, carriage return, end-of-transmission, ring the bell, etc. Other languages use Roman letters with accents, or use entirely different character sets, or use ideograms. Strings and String Functions
Background image of page 4
ENCMP 100 5 ©2011 by ECE, UofA The 7-bit ASCII Code for Characters "American Standard Code for Information Exchange 0 1 2 3 4 5 6 7 8 9 0110000 0110001 0110010 0110011 0110100 0110101 0110110 0110111 0111000 0111001 A B C D E F . . Y Z 1000001 1000010 1000011 1000100 1000101 1000110 . . 1011001 1011010 a b c d e f . . y z 1100001 1100010 1100011 1100100 1100101 1100110 . . 1111001 1111010 In addition to the 10 digit codes and 52 letter codes: space character + 32 printable symbols delete code + 32 other nonprintable control codes Strings and String Functions
Background image of page 5

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

View Full DocumentRight Arrow Icon
ENCMP 100 6 ©2011 by ECE, UofA The Full ASCII Code in Tabular Form Source: www.wikipedia.org Strings and String Functions
Background image of page 6
ENCMP 100 7 ©2011 by ECE, UofA International Character Encodings ASCII was designed in 1963 to be efficient at repre- senting English and for controlling (now mostly obsolete features) on input/output equipment of that time. ASCII appeared at a critical moment in the Computer Revolution, when there was a need to standardize printers, terminals, etc., so it became very widely used. ASCII was also a useful tool for competitors of the then
Background image of page 7

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

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

Page1 / 33

09_stringFunctions - String Functions ENCMP 100 Overview 2...

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

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