MATLAB BUILDER JA 2 Uživatelská příručka Strana 119

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 292
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 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
Zobrazit stránku 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 291 292

Komentáře k této Příručce

Žádné komentáře