About 6,210,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. how to get name of a function (within the function) - MATLAB …

    May 6, 2019 · mfilename is not an acceptable answer, as it returns the current file name, not the function's name. If you rely on mfilename inside a function and, for instance, this function gets incorporated as a method in a class, it will not return the expected output.

  3. inputname - MathWorks

    inputname is a convenient way to communicate the name of an input variable to a function. For example, a function checks the data types of inputs and, if it finds an incorrect type, displays the name of the variable from your workspace.

  4. functions - MathWorks

    s = functions(fh) returns information about a function handle. This information includes the function name, type, and file name. Use the functions function for querying and debugging purposes only.

  5. Create Functions in Files - 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 workspace specific to that function, which is separate from the base workspace.

  6. Name=Value in Function Calls - MathWorks

    Use the name=value syntax to help identify name-value arguments for functions and to clearly distinguish names from values in lists of name-value arguments. Most functions and methods support both syntaxes, but there are some limitations …

  7. Change function name everywhere - MATLAB Answers - MathWorks

    Apr 3, 2019 · I was wondering if there is a way to change the name of a function and simultanously change it in the scripts where it is called. It is probably better just to create an alias for the original file function varargout=newfunction(varargin)

  8. Variable Names - MathWorks

    In some cases, load or eval add variables that have the same names as functions. Unless these variables are in the function workspace before the call to load or eval, the MATLAB parser interprets the variable names as function names. For more information, see:

  9. How to create function with name-value pair arguments?

    Mar 27, 2024 · To provide some sample code on how to do this with data in a structure, here is an example. We are have two variables 'x' and 'z' that are stored in structure 'params', and a test function looks to compute x+z +5. I have a simple check that the name is type character, but you can add more, or tailor to your needs. The function would look like:

  10. Function Precedence Order - MathWorks

    This topic explains how MATLAB ® determines which function to call when multiple functions in the current scope have the same name. The current scope includes the current file, an optional private subfolder relative to the currently running function, the …