MATLAB POLYSPACE RELEASE NOTES Manuel d'utilisateur Page 165

  • 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 164
Scripts and Functions
The two global statements make the value assigned to GRAVITY at the
command prompt available inside the function. You can then modify
GRAVITY
interactively and obtain new solutions without editing any files.
Passing String Arguments to Functions
You can write MATLAB functions that accept string arguments without the
parentheses and quotes. That is, MATLAB interprets
fooabc
as
foo('a','b','c')
However, when you use the unquoted form, MATLAB cannot return output
arguments. For example,
legend apples oranges
creates a legend on a plot using the strings apples and oranges as labels. If
you want the
legend command to return its output arguments, then you
must use the quoted form:
[legh,objh] = legend('apples','or ange s');
In addition, you must use the quoted form if any of the arguments is not
astring.
Caution While the unquoted syntax is convenient, in some cases it can be
used incorrectly without causing MATLAB to generate an error.
Constructing String Arguments in Code
The quoted form enables you to construct string arguments within the
code. The following example processes multiple data files,
August1.dat,
August2.dat, and so on. It uses the function i nt2str,whichconvertsan
integer to a character, to build the filename:
ford=1:31
4-27
Vue de la page 164
1 2 ... 160 161 162 163 164 165 166 167 168 169 170 ... 239 240

Commentaires sur ces manuels

Pas de commentaire