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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 292
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 118
Using Class Methods
Example Testing for an Empty MWArray
Display a message if array object A is an empty array. Otherwise, display
the contents of
A:
if (A.isEmpty())
System.out.println("Matrix A is empty");
else
System.out.println("A = " + A.toString());
When run, the example displays the contents of A:
A=123456
7 8 9101112
13 14 15 16 17 18
numberOfDimensions. This method returns the number of dimensions of
the array object.
The prototype for the
numberOfDimensions method is as follows:
public int numberOfDimensions()
Input Parameters
None
Example Getting the Number of Dimensions of an MWArray
Display the number o f dimensions for array object A:
System.out.println("Matrix A has " + A.numberOfDimensions() +
" dimensions");
When run, the example displays this output:
Matrix A has 2 dimensions
numberOfElem ents. This method returns the total number o f elements in
the array object.
4-43
Przeglądanie stron 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 291 292

Komentarze do niniejszej Instrukcji

Brak uwag