Matlab → Basics → Variables → Functions → Display Formats

In the example given in Matlab Built-In Functions section, the Matlab showed the answers `A=2.7987e+03`

for part-a and `A=3.0237e+03`

in part-b. This is the default display format of Matlab. And with the command,

`>> format long g`

>> P=2000; r=0.08; t=4.2;

>> A=P*exp(r*t)

A =

2798.67804962186

The Matlab will display the answer in this way. The next Table lists the different display formats.

Command |
Answer |

`>> format short` |
3.1429 NOTE: This is the default format. |

`>> format long` |
3.142857142857143 |

`>> format bank` |
3.14 |

`>> format short g` |
3.1429 |

`>> format long g` |
3.14285714285714 |

By using the command `>> help format`

we can find every information about different formats in Matlab. Similarly, we can use the help command to display help text in command window. Try the following commands:

`>> help who`

>> help sqrt

>> help clc

If you wish to clear the command window, just type `>> clc`

and press Enter. And if you wish to use or edit the previous commands, just press the up-arrow and the earlier used commands will be displayed. For example,

`>> I`

(cursor) Press the up-arrow button.

The next table lists some more useful Matlab commands.

Command |
Outcome |

`>> clc` |
Clear the command window. |

`>> clear` |
Remove all variables from the memory. |

`>> clear x y z` |
Remove only x, y, z variables from the memory. |

`>> who` |
Display a list of variables currently in the memory. |

`>> whos` |
Display variables currently in memory with detailed information. |

`>> help ` |
List the help topics. |