MATLAB POLYSPACE RELEASE NOTES Manuel d'utilisateur Page 152

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 240
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 151
4 Programming
Internally, the characters are stored as numbers, but not in floating-point
format. The statement
a = double(s)
converts the character array to a numeric matri
x containing floating-point
representations of the ASCII codes for each ch
aracter. The resul t is
a=
72 101 108 108 111
The statement
s = char(a)
reverses the conversion.
Converting numbers to characters makes it possible to investigat e t he various
fonts available on your computer. The printable characters in the basic A SCII
character set are represented by the integers
32:127. (The integers less than
32 represent no nprintable control characters.) These integers are arranged in
an appropriate 6-by-16 array with
F = reshape(32:127,16 ,6)';
The printable characters in the extended ASCII character set are represented
by
F+128. When these integers are interpreted as characters, the result
depends on the font currently being used. Type the statements
char(F)
char(F+128)
and then vary the font being used for the Command Window. Select
Preferences from the File menu to change the font. If you include tabs in
lines of code, use a fixed-width font, such as Monospaced, to align the tab
positions on different lines.
Concatenationwithsquarebracketsjoins text variables together into larger
strings. The statement
h = [s, ' world']
4-14
Vue de la page 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 239 240

Commentaires sur ces manuels

Pas de commentaire