Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

function

endfunction

function declaration.

Syntax

  • function [out_1,...,out_M,varargout] = fname(in_1, ... , in_N, varargin)
  • function fname(in_1, ... , in_N, varargin)
  • function [out_1,...,out_M,varargout] = fname()
  • function fname()

Description

function opens a function definition.

endfunction closes a function definition (optional, but strongly recommended).

Example

in a file: demo_function.m

function r = demo_function(a, b)
  r = a + b;
endfunction

See also

addpath.

History

VersionDescription
1.0.0initial version

Author

Allan CORNET