Join Patrick Royal for an in-depth discussion in this video Creating functions, part of Learning MATLAB.
Let's investigate how to create a simple function in MATLAB. …Functions are very similar to scripts in many ways but they have different output …and input protocols. Whereas a script is meant to run on its …own and runs the same way every time. A function takes an input from the user …each time it runs. Making it a more general and powerful tool. …Similarly whereas scripts don't usually have predefined output other than what is …displayed on the command window or on a plot.…
Functions directly provide their output for use by other scripts or functions …that call them. For this video I will rewrite the script …created in the previous video into a function. …To start with, click on the New dropdown menu and choose to create a new function. …Then save that function as practicefunction.m. …Right away you will see that rather than providing a blank screen, MATLAB …automatically writes in some basic information.…
The first line is the most important because it defines how the function can …be used. Essentially when you type in the function …
- Installing MATLAB
- Working with MATLAB variables
- Working with matrix and scalar operations
- Creating functions
- Understanding performance considerations
- Building basic plots
- Creating responsive programs
- Editing variables manually
- Working with the Statistics Toolbox
Skill Level Intermediate
1. General Concepts
2. Core MATLAB Syntax
3. Programming in MATLAB
4. Data Representations
5. External Toolboxes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.