Funktionserstellung
Funktionen enthalten einen oder mehrere sequentielle Befehle und können Eingaben akzeptieren und Ausgaben zurückgeben. Um ein Programm mit mehreren Codezeilen zu schreiben, erstellen Sie eine benannte Funktion in einer Datei.
Wenn Sie alternativ eine einzeilige Funktion für die Übergabe an eine andere Funktion definieren möchten – etwa einen mathematischen Ausdruck, der an die integral
-Funktion übergeben soll –, können Sie eine anonyme Funktion erstellen.
MATLAB-Sprachsyntax
function | Deklarieren von Funktionsname, Eingaben und Ausgaben |
Themen
- Create Functions in Files
Store multiple commands in a program file that can accept inputs and return output.
- Types of Functions
There are several types of functions available with MATLAB®, including local functions, nested functions, private functions, and anonymous functions.
- Function Precedence Order
To determine which function to call when multiple functions in the current scope have the same name, MATLAB uses function precedence order.
- Add Help for Your Program
Add help text to your program that displays in the Command Window when you use the
help
function. - Indexing into Function Call Results
This topic describes how to dot index into temporary variables created by function calls.
- Configure the Run Button for Functions
Run functions that require some initial setup from the Editor by configuring the Run button.