About 363,000 results
Open links in new tab
  1. function - MathWorks

    function [y1,...,yN] = myfun(x1,...,xM) declares a function named myfun that accepts inputs x1,...,xM and returns outputs y1,...,yN. This declaration statement must be the first executable line of the function. Valid function names begin with an alphabetic character, and can contain letters, numbers, or underscores.

  2. Create Functions in Files - MathWorks

    This type of function must be defined within a file, not at the command line. Often, you store a function in its own file. In that case, the best practice is to use the same name for the function and the file (in this example, fact.m), since MATLAB ® associates the program with the file name. Save the file either in the current folder or in a ...

  3. Function Creation - MathWorks

    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. Update Code for R2019b Changes to Function Precedence Order; Add Help for Your Program

  4. How to Create a MATLAB Function - MATLAB - MathWorks

    Sep 18, 2020 · Learn how to create MATLAB function and why functions same time and effort when writing code. Functions are tasks or a set of tasks that are performed on a given set of input that transforms the input into a desired output.

  5. Local Functions - MathWorks

    That is, when you call a function or method within a program file, MATLAB checks whether the function is a local function before looking for other main functions. Therefore, you can create an alternate version of a particular function while retaining the original in another file.

  6. at symbol - MathWorks

    Create a function handle to an anonymous function. ... Run the command by entering it in the MATLAB ...

  7. Add Functions to Scripts - MathWorks

    To create a script or live script with local functions, go to the Home tab and select New Script or New Live Script. Then, add code to the file. Each local function must begin with its own function definition statement and end with the end keyword. The functions can appear in any order and can be defined anywhere in the script.

  8. Nested Functions - MathWorks

    When you create a function handle for a nested function, that handle stores not only the name of the function, but also the values of variables explicitly referenced by the nested function. Variables in the parent workspace that are referenced by nested functions are cleared once the last nested function handle created by that call to the ...

  9. How can I create a function with multiple variables?

    Dec 6, 2019 · Save this in yourFunctionName.m or use whatever name you want for the function just make sure it's the same on the function line as the name of the m file is. 0 Comments Show -2 older comments Hide -2 older comments

  10. Anonymous Functions - MathWorks

    However, an anonymous function returns only one output. If the expression in the function returns multiple outputs, then you can request them when you invoke the function handle. For example, the ndgrid function can return as many outputs as the number of input vectors. This anonymous function that calls ndgrid returns only one output (mygrid).

Refresh