About 50 results
Open links in new tab
  1. In MATLAB, can I have a script and a function definition in the same ...

    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 call them …

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

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

  4. 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 returning a handle to …

  5. 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 instead, the …

  6. What's the closest thing to #define in Matlab? - Stack Overflow

    1 I second AB's response, declare a function that simply returns a constant value. The other possibility is to just #define whatever you want and preprocess your .m files using cpp. Then however you lose …

  7. Define function in matlab without using new function

    Feb 28, 2013 · I have a matlab file for my codes , I want to define a new function in this file and I don't want to add new file for this function because this file is my codes that control agents in Webots , and …

  8. Is it possible to define more than one function per file in MATLAB, and ...

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

  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 yes, those are …

  10. Define multiple variables at the same time in MATLAB?

    Nov 28, 2015 · I don't know if MATLAB can do this, and I want it purely for aesthetics in my code, but can MATLAB create two variables at the same time? Example x = cell(4,8); y = cell(4,8); Is there a …