About 76,200 results
Open links in new tab
  1. math - Optional args in MATLAB functions - Stack Overflow

    Jul 20, 2011 · How can I declare function in MATLAB with optional arguments? For example: function [a] = train(x, y, opt), where opt must be an optional argument.

  2. Is it possible to define more than one function per file in MATLAB, …

    Aug 26, 2010 · The first function in an m-file (i.e. the main function), is invoked when that m-file is called. It is not required that the main function have the same name as the m-file, but for clarity …

  3. In MATLAB, can I have a script and a function definition in the …

    Mar 19, 2011 · For more complicated functions, you will have to define them in their own files, place them somewhere on the MATLAB path to make them accessible to your script, and then …

  4. How do I set default values for functions parameters in MATLAB?

    Apr 28, 2009 · Within the wave function then check, whether the struct parameters contains a field called 'flag' and if so, if its value is non empty. Then assign it either a default value you define …

  5. Constants in MATLAB - Stack Overflow

    37 Matlab has constants now. The newer (R2008a+) "classdef" style of Matlab OOP lets you define constant class properties. This is probably the best option if you don't require back …

  6. matlab - What is a function handle and how is it useful ... - Stack ...

    May 16, 2017 · Since the function increment is a nested function, it can only be used within the function start_counting (i.e. the workspace of start_counting is its "scope"). However, by …

  7. arrays - How do i define a structure in Matlab - Stack Overflow

    Jul 8, 2013 · 6 Unlike C, Matlab allows you to add or remove members from a struct as you go. It's more of a convention that a struct with certain fields can be used with certain functions. So …

  8. Matlab - Defining a math function - Stack Overflow

    defines a standard, numerical function. More specifically, it defines an anonymous function, and then defines f as a handle to that function, with the result that f can be used as the function …

  9. How can I create a piecewise inline function in MATLAB?

    Nov 6, 2013 · I have a function in MATLAB which takes another function as an argument. I would like to somehow define a piecewise inline function that can be passed in. Is this somehow …

  10. Define a variable and use it in all sub-function on Matlab

    Dec 14, 2016 · If you are worried about performance, you should know that Matlab efficiently use variables as reference to data only, so you can safely send a variable in to a function (thereby …