About 128,000 results
Open links in new tab
  1. Create Functions in Files - MATLAB & Simulink - MathWorks

    The body of a function can include valid MATLAB expressions, control flow statements, comments, blank lines, and nested functions. Any variables that you create within a function are stored within a …

  2. function - Declare function name, inputs, and outputs - MATLAB

    This MATLAB function declares a function named myfun that accepts inputs x1,...,xM and returns outputs y1,...,yN.

  3. Function Creation - MATLAB & Simulink - MathWorks

    Functions contain one or more sequential commands and can accept inputs and return outputs. When you have multiple lines of code, use the function keyword to define a function within a file.

  4. at symbol - Create anonymous functions and function handles, call ...

    The at symbol (@) creates handles to anonymous and named functions, and is also used to call superclass methods from within a subclass. For instance, f = @(x,y) x+y creates an anonymous …

  5. Local Functions - MATLAB & Simulink - MathWorks

    This topic explains the term local function, and shows how to create and use local functions. MATLAB ® program files can contain code for more than one function.

  6. Create Function Handle - MATLAB & Simulink - MathWorks

    Use a function handle to create an association to a named function or an anonymous function.

  7. Add Functions to Scripts - MATLAB & Simulink - MathWorks

    Add functions to scripts to reuse code within a script and avoid creating and managing separate function files.

  8. Anonymous Functions - MATLAB & Simulink - MathWorks

    You can create an anonymous function that returns multiple outputs using the deal function. See Return Multiple Outputs from Anonymous Function for an example.

  9. Nested Functions - MATLAB & Simulink - MathWorks

    For example, create a function in a file named makeParabola.m. This function accepts several polynomial coefficients, and returns a handle to a nested function that calculates the value of that …

  10. Function Handles - MATLAB & Simulink - MathWorks

    A function handle is a MATLAB ® data type that represents a function. A typical use of function handles is to pass a function to another function. For example, you can use function handles as input …