Characters and encoding, MATLAB Programming

Characters and Encoding:

A character in a MATLAB is represented by using single quotes (example, 'a' or 'x'). The quotes are essential to denote a character; without them, the letter would be interpreted as the variable name. The Characters are place in an order using what is termed as a character encoding. In character encoding, all characters in the computer's character set are placed in a sequence and given equal integer values. The character set involves all letters of the alphabet, punctuation marks, digits, and more; mainly, all the keys on a keyboard are characters. Special characters like the Enter key are also included. Therefore, 'x', '!', and '3' are all characters. With the quotes, '3' is a character, not a number. The most general character encoding is the American Standard Code for Information Interchange, or ASCII. The standard ASCII has 128 characters that have equivalent integer values from 0 to 127. The first 32 (i.e.integer values 0 through 31) are nonprinting characters. The letters of the alphabet is in order that means 'a' comes before 'b, then c,' and so on.

The numeric functions can be used to convert a character to its equal numeric value (example, double will convert to the double value; int32 will convert to an integer value using the 32 bits, etc.). For illustration, to convert the character 'a' to its numeric equivalent, the statement below could be used:

>> numequiv = double('a')

numequiv =


This stores the double value 97 in the variable numequiv that shows that the character 'a' is the ninety-eighth character in the character encoding (as the equivalent numbers start at 0). It doesn't matter which number type is used to convert 'a', for illustration,

>> numequiv = int32('a')

would also store the integer value 97 in the variable numequiv. The only dissimilarity between these will be the type of the resulting variable (double in the first case, int32 in the second case).

Posted Date: 10/18/2012 4:06:47 AM | Location : United States

Related Discussions:- Characters and encoding, Assignment Help, Ask Question on Characters and encoding, Get Answer, Expert's Help, Characters and encoding Discussions

Write discussion on Characters and encoding
Your posts are moderated
Related Questions

how to model a diode in matlab given data

Consider the function: f(x) = 7 - 28x + 42x 2 - 28x 3 + 7x 4 : Write a script findPolyRoot.m to nd, as accurately as you can, the root of f(x) near x = 2. Your script mu

Appending data to a data File: A text file once exists; the data can be appended to it. The format is similar as formerly, with the addition of the qualifier -append. For illu

Illustration of Modifying Elements: Illustration, the fifth element in the vector newvec is 9 >> newvec(5) ans = 9 The subset of a vector, that would be a vector it

Savannah says that the least common multiple of 4 and 6 is 24. Is she right or what is her mistake?

Job: Add sinusoid with frequency 1000 Hz and amplitude 100 to the one generated in Job 1 (: Create a function using mat lab to generate a sinusoidal signal. The parameters of the s

In MATLAB, create a correlation matrix for all of the variables in the data (it should be an 8x8 matrix). To do this you will have to convert the "southern"variable into a number.

Write a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination. Your function should accept a matrix as an argument and

Variable numbers of arguments: In the functions there have been a fixed number of input and output arguments. For illustration, in the function below, there is one input argum