# Where to write and save MATLAB program

If you are starting to write a MATLAB program first time then you should read this post. Previously, we learn What is MATLAB and its elements. Now we will learn where to write and save matlab program.

All the program in MATLAB are written in editor window (New M-File). The file of this matlab program have dot m extension. For example, if you are naming the program file as 'mod0101' then file will be saved as 'mod0101.m'.

Figure.1 - Screen capture of MATLAB editor window.

To open this window, you need to click on

**'New M-File'**icon as shown in above figure-1. After clicking on this icon blank editor window will open, where you can write your MATLAB program.
There is also a another way to open editor window as shown in figure-2.

Figure.2 - Screen capture of MATLAB editor window with Blank M-file, Function M-file and Class M-file.

First of all click on 'File -> New' then you will find three options: 1) Blank M-file, 2) Function M-file and 3) Class M-File.

**1)**

**Blank M-file:**It is a blank editor window in which nothing is included which gives you freedom to write a program according to your requirements.

**2)**

**Function M-file:**This editor window consist of two lines of code required to create a function m-file. This file gives you idea about the pattern of the function file.

**3)**

**Class M-file:**This editor window consists of six lines of code required to create a class m-file. This file gives you idea about the pattern of the class file.

**Video Tutorial:**Where to write MATLAB Program By INFO4EEE

[…] we learn where to write and save MATLAB program. Now we will discuss how to write your first MATLAB […]

ReplyDelete[…] Where to write and save MATLAB program? In this matlab tutorial, we discussed about blank M-file, function M-file and Class M-file. […]

ReplyDelete[…] Read Post-02 of Module-II: Where to write and save MATLAB program? […]

ReplyDelete