About  diary  command  in MATLAB


diary LAB1.text command opens a text file in background ( you do no tsee it now, we can access it later using "pico".) Matlab will copy whatever you type in your  MATLAB session in the file  LAB1.text
If you  forget  typing 
diary LAB1.text  nothing will be recorded or saved, so you have to redo everything again.

At the end, When you are done with your LAB,   Type the following  three commands

>> save
>> diary off
>> exit

The first command ( save)  will save your variables in a file called matlab.mat, this is binary format file and will be used ( by typing load) to recall your matrices.

The second command ( diary off) will stop writting in LAB1.text, then save and close the file LAB1.text.
The third command will exit MATLAB and return you to computer command line with $ promp.

To view,  edit, print, or submit the file LAB1.text,  you need to exit  Matlab and use an editor  for example  "pico".
 

You can not open  LAB1.text     in Matlab.

>> pico LAB1.text  Will produce error

But afte exiting MATLAB  you can use pico :

pico LAB1.text  Will show yu the file