Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.1 - Français

Change language to:
English - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Aide Scilab >> Fonctions > varargout

varargout

variable numbers of arguments in an output argument list

Description

A function whose output argument list contains varargout must be called with more output arguments than indicated in the output argument list. The calling arguments passed form varargout keyword onwards are extracted out of the varargout list defined in the function.

varargout= function ex() may be called with any number of output arguments. Within function ex output arguments may be stored in in varargout(i).

[X1,...Xn,varargout]= function ex() may also be used. In this case the Xi variables must be assigned in the function as well as varargout(i).

The actual total number of output argument is given argn(1)

Remark

The varargout variable must be created within the function and assigned to a list. If varargout is the only formal output variable the list must contain at least one entry.

Examples

function varargout=exampl()
  varargout=list(1,2,3,4)
endfunction

x=exampl()
[x,y]=exampl()
[x,y,z]=exampl()

function [a, b, varargout]=exampl1()
  a='first'
  b='second'
  varargout=list(1,2,3,4)
endfunction

exampl1()
[a,b]=exampl1()
[a,b,c]=exampl1()

See Also

  • function — définition d'une fonction Scilab
  • varargin — variable numbers of arguments in an input argument list
  • list — Objet Scilab, Définition d'une liste
<< varargin Fonctions Outils de développement >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Mar 03 11:00:15 CET 2011