- Contact us
To start MATLAB on a Microsoft Windows platform,
Note: All of the desktop components that were open when you last shut down MATLAB will be opened on startup.
If you already know C, a lot of MATLAB code will be familiar to you. The main advantage of MATLAB over C when doing numerical calculations is that MATLAB is interpreted. That is, you can see the result of one command before you continue on to the next one, unlike C where you must compile the source each time you make a change.
The startup directory is the current directory in MATLAB when it first starts, and depends on your platform and installation. You can specify a different startup directory. Startup file is executed when the MATLAB is started/ initiated.
Startup Directory on Windows Platforms
On Windows platforms, when you installed MATLAB, the default startup directory was set to $MATLABroot/work, where $MATLABroot is the directory where MATLAB files are installed.
Startup Directory on UNIX Platforms
On UNIX platforms, the initial current directory is the directory you are in on your UNIX file system when you start MATLAB.
Changing the Startup Directory
You can start MATLAB in a different directory from the default. The directory you specify will be the current working directory when MATLAB starts.
For Windows Platforms Only
To change the startup directory on Windows platforms: Right-click the MATLAB shortcut icon and select Properties from the context menu. The Properties dialog box for MATLAB.exe opens to the Shortcut page. Enter the new startup directory in the Start in field and click OK. The next time you start MATLAB using that shortcut icon, the current directory will be the one you specified in step 2. You can make multiple shortcuts to start MATLAB, each with its own startup directory, and with each startup directory having different startup options
To end your MATLAB session
Note: When you close the MATLAB without closing editor window, then when you start again, previous editor windows will be opened by default.
When you start MATLAB, the MATLAB desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following illustration shows the default desktop as shown in Figure 1. You can customize the arrangement of tools and documents to suit your needs. For more information about the desktop tools, see Desktop Tools and Development Environment.
Figure 1. Default window of the MATLAB when you start
c = 500
In MATLAB, in the table the first four out of seven windows are extensively used and are listed below Table (1)
|Description of window||Window|
· It’s a main window
· Enters the variables
· Runs the program
· Open the programs
· Where we write programs using commands.
i.e create and debug the script and function files
|Figure window· Representing results (output) in graphical form.
|Help window.It provides complete information about the MATLAB
>> doc help
>>help toolbox (help simulink)
>>help topic ( help graph2d)
>>help command (help sqrt)
>> doc command (doc sqrt)
>> doc topic (doc simulink)
>>doc command (doc sqrt)
|Current directory· Shows all files in the current directory
· The file where you are working
|Workspace windowProvides the information of current variables used by you with Name, value, type Min and Max,|
|Command historyLogs the commands in command window in the date and time format|
|Launch pad WindowProvides the access to Toolboxes, SIMULINK, demos etc.,|
This is a main window where simple commands, programs can be executed as shown in Figure (2). User defined programs can be opened and can be modified as per the requirements.
Notes for working in the Command Window
Start a MARLAB and define A=10; a=5; B=6; b=15, Compute +,-,* (multiplication) ,/(left didision), \ (right division).
The most useful command in MATLAB is help. This brings up a description of the command you are asking help for. An example of this is:
>> help det DET Determinant. DET(X) is the determinant of the square matrix X. Use COND instead of DET to test for matrix singularity. See also COND. Overloaded methods help sym/det.m
All examples in this document will have two greater than symbols followed by a command which can be cut and paste into your version of MATLAB.
Note in the above example, it is asked for help on det and instead, the help page indicates that you should use DET(X). This is explained by the following line from help help
Note: In the online help, keywords are capitalized to make them stand out. Always type commands in lowercase since all command and function names are actually in lowercase.Example: >> help for FOR Repeat statements a specific number of times.The general form of a FOR statement is: FOR variable = expr, statement, ..., statement END
When asking for help for operators, for example, +, .*, or ', MATLAB will bring up a help page which looks like:
>> help +