This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Call Functions

These examples show how to call a MATLAB® function. To run the examples, you must first create numeric arrays A and B, such as:

A = [1 3 5];
B = [10 6 4];

Enclose inputs to functions in parentheses:


Separate multiple inputs with commas:


Store output from a function by assigning it to a variable:

maxA = max(A)

Enclose multiple outputs in square brackets:

[maxA, location] = max(A)

Call a function that does not require any inputs, and does not return any outputs, by typing only the function name:


Enclose text inputs in single quotation marks:

disp('hello world')

Related Examples

Was this topic helpful?