About 65,000 results
Open links in new tab
  1. 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 …

  2. 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 …

  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. 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.

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

    Apr 28, 2009 · 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 …

  6. 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 …

  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. 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 …

  9. matlab - How do I define variables in simulink model (instead of in ...

    Jul 16, 2020 · I want to define a few variables in a simulink model. The matlab function block doesn't work because the variables are local. The variables are not input to other blocks, but …

  10. MATLAB: Defining a function in terms of another function

    Jan 9, 2018 · The value of y is bound permanently to the function. Whether you do clear y or assign a different value to it, the value of y used in g will be whatever it was when you first …