![]() |
VOOZH | about |
MATLAB is an interactive multi-programming language and numeric computing environment developed by MathWorks. MATLAB provides the Commands that will be used when the user wants to interact with any application using the command line interface.
Following are the lists of commands used in MATLAB.
Command | Use |
|---|---|
| clc | Clears command window |
| clear | Removes the variables from memory |
| global | Declares variables globally |
| exist | Checks for the existence of a particular file or memory |
| help | Searches for a help topic |
| quit | Stops MATLAB |
| who | Lists current variables in use |
| lookfor | Searches help entries for a keyboard |
Example 1
Output:
x = val;
Example 2
Output:
Variables in the current scope: x
Example 3
Output:
error: type 'x' is undefined
| Command | Use |
| cd | Changes current directory |
| date | Displays current date |
| delete | Deletes a file |
| dir | Lists all the files in a directory |
| path | Displays search path |
| pwd | Displays current directory |
| type | Displays content of a file |
| wklread | Reads.wk1 spreadsheet file |
| save | Saves workplace variables in a file |
Example 1
Output:
ans = /home/oo
Example 2
Output:
c= '18-jun-2021'
| Command | Use |
| disp | Displays content of an array or a string |
| fscanf | Reads formatted data from a file |
| format | Controls screen-display format |
| fprintf | Performs formatted writes to file or screen |
| input | Displays the prompt and waits for input |
| ; | Suppresses screen printing |
Example 1
Output:
15 150 Hello World.
Example 2
Output:
20
| Command | Use |
| cat | Concatenates the array |
| find | Finds the indices of nonzero elements |
| max | Returns the largest element |
| min | Returns the smallest element |
| prod | Product of each column |
| sort | Sorts each column |
| rank | Computes rank of a matrix |
| eye | Creates an identity matrix |
| inv | Computes the inverse of a matrix |
Example 1
Output:
ans = 1 2 3 4 5 6
Example 2
Output:
ans = 3
Example 3
Output:
ans = 4
Output:
ans = Diagonal Matrix 1 0 0 1
Plotting Commands:
| Commands | Use |
| axis | Sets axis limit |
| grid | Displays grid lines |
| plot | Generates xy plot |
| title | Puts title at top of the plot |
| close | Closes current plot |
| bar | Creates bar chart |
| Prints the plot / saves the plot | |
| figure | Opens a new figure window |
| Close all | Closes all plots |
Example1:
Output:
👁 ImageExample 2:
Output:
👁 Image