MATLAB BUILDER JA 2 Guía de usuario Pagina 56

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 292
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de 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
Vista de pagina 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 291 292

Comentarios a estos manuales

Sin comentarios