MATLAB BUILDER JA 2 Guida Utente Pagina 119

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 292
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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
Vedere la pagina 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 291 292

Commenti su questo manuale

Nessun commento