MATLAB BUILDER JA 2 Guide de l'utilisateur Page 190

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 292
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 189
4 Using MWArra y Classes
Example Getting Character Array Data with getChar
Use getChar to display the string stored in MWCharArray object A:
char[] chArray = {'H', 'e', 'l', 'l', 'o'};
MWCharArray A = new MWCharArray(chArray);
for (int i = 1; i <= 5; i++)
System.out.print(A.getChar(i));
When run, the example displays this output:
Hello
set. T his method replaces the character located at the sp ecified one-based
offset in the
MWCharArray object with the specified char value.
To set the element at a specific index, use one of
public void set(int index, char element);
public void set(int[] index, char element);
Use the first syntax (int index) to return the ele ment at the specified
one-based offset in the a rray, accessing elements in column-wise order. Us e the
second syntax (
int[] index) to return the element at the specified array of
one-based indices. The first syntax offers better performance than the second.
Input Parameters
element
New element to replace at index
index
Index of the requested element in the MWCharArray
In the case where index is of type int, the valid range for index is 1<=index
<= N
,whereN is the total number of elements in the array.
4-114
Vue de la page 189
1 2 ... 185 186 187 188 189 190 191 192 193 194 195 ... 291 292

Commentaires sur ces manuels

Pas de commentaire