MATLAB BUILDER JA 2 Guida Utente Pagina 56

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 292
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 55
3 Programming
y = sum([varargin{:}]);
This function returns the sum of the inputs. The inputs are provided as a
varargin argument, which means that the caller can specify any num ber of
inputs to the function. The result is returned as a scalar
double.
Code Fragment: Passing Variable Numbers of Inputs
Jav a Builder generates a Java interface to this function as follows:
/* mlx interface - List version*/
public void mysum(List lhs, List rhs)
throws MWException
{
(implementation omitted)
}
/* mlx interface - Array version*/
public void mysum(Object[] lhs, Object[] rhs)
throws MWException
{
(implementation omitted)
}
/* standard interface - no inputs */
public Object[] mysum(int nargout) throws MWException
{
(implementation omitted)
}
/* standard interface - variable inputs */
public Object[] mysum(int nargout, Object varargin)
throws MWException
{
(implementation omitted)
}
In all cases, the varargin argument is passed as type Object.Thislets
you provide any number of inputs in the form of an array of Object, that
is
Object[], and the contents of this array are passed to the compiled
3-10
Vedere la pagina 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 291 292

Commenti su questo manuale

Nessun commento