TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Matlab

Functions in MATLAB

Introduction

A function is a set of instructions when invoked does a specific task to the caller. MATLAB has many in-built functions that we can call in out programs. We can also write our own functions in MATLAB.

  • MATLAB in-built Functions.
  • User defined Functions.

User defined Function

The key components of a function in MATLAB are:

  • Function Header
  • Comments
  • Function Body

Create a Function

To create a new function, go to the Home tab, click on the plus icon in the Tool strip.

Choose New >> Function menu option to create a new function.

 

New Function

 

This opens the function editor. We can define the function header, comments and the function body in the editor.

We can create, edit and save function using the editor.

MATLAB Function Editor

Function Header

Function header specifies the function output arguments, function name and input arguments to the function. The output arguments are enclosed in square brackets. The input arguments are enclosed within parentheses. Sample function header :

[out] = foo(arg1,arg2)

Related Posts

Matlab /

Taylor series expansion MATLAB Example

MATLAB For Loop Script

Matlab /

For Loop Example in MATLAB

plot command MATALB

Matlab /

MATLAB 2D Plot command

Pie Chart Demo Matlab

Matlab /

Pie Chart Example using MATLAB

MATLAB Command Window

Matlab /

MATLAB Command Window

‹ MATLAB Command Window› Pie Chart Example using MATLAB

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Print Triangle Pattern Flowchart
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version