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

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

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

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

  7. matlab - How to use conditions within an anonymous function

    Jul 2, 2013 · But in case, we have a function that takes different representation on different intervals for e.g : if abs(x)<3 fun = x^.2 else 0 How can we use the same way (i mean use …

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

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

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