MATLAB BUILDER JA 2 Podręcznik Użytkownika Strona 107

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 106
Guidelines for Working with MWArray Classes
Method Usage
set(int,
Object)
Replaces the element at the one-based index with the
supplied value (inherited from
MWArray).
set(int[],
Object)
Replaces the element at the one-ba s ed inde x array
with the supplied value (inherited from
MWArray).
set(int, char)
Replaces the element at the one-based index with the
supplied
char value.
set(int[],
char)
Replaces element at the one-based index array with
the supplied
char value.
The get methods return a java.lang.Character representing the character
at the specified index. The
getChar methods do the same thing, except they
return a primitive
char value. The set methods replace the character at the
specified index with the supplie d value. The se methods c oll ecti vel y support
types
char, java.lang.Character,andjava.lang.String (u se a String of
length
1 to pass a character to replace).
Replacing Character Occurrences Using MWCharArray Methods. This
example replaces e very occurrence of a given character in an
MWCharArray
with a specified new character:
void replaceWithChar(MWCharArray a, char ch, char newch)
{
if (a == null)
return;
for (int k = 1; k <= a.numberOfElements(); k++)
{
if (a.getChar(k) == ch)
a.setChar(k, newch);
}
}
Working with Cell Arrays
The MWCellArray class provides a Java interface to a MATLAB cell array.
4-31
Przeglądanie stron 106
1 2 ... 102 103 104 105 106 107 108 109 110 111 112 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag