MATLAB BUILDER JA 2 Guia do Utilizador Página 56

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 292
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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 página 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 291 292

Comentários a estes Manuais

Sem comentários