Diary

On the octave prompt, we can type commands and check the outputs. If that command is useful, we can include it in the script. These testing sessions can be recorded in the text format using the command “Diary”. Diary can be useful various ways:

  • It will store the commands and corresponding results for our reference.
  • It gives the effect of taking a “screen-shot” of the total session.

I have pasted a diary session below. It records the session when I asked help about the “diary” command. I did it like this:

  1. Gave the command: “diary diaryinfo.txt”. This tells octave to record the session in the text file “diaryinfo.txt”.
  2. Gave the command: “help diary”.
  3. After I read the help for the command “diary”, I gave the command: “diary off”.
  4. Now diaryinfo.txt is available to me for my reference. I paste it below:
octave:5> help diary
 'diary' is a built-in function from the file libinterp/corefcn/pager.cc
-- Command: diary
 -- Command: diary on
 -- Command: diary off
 -- Command: diary FILENAME
 Record a list of all commands _and_ the output they produce, mixed
 together just as they appear on the terminal.
Valid options are:
on
 Start recording a session in a file called 'diary' in the
 current working directory.
off
 Stop recording the session in the diary file.
FILENAME
 Record the session in the file named FILENAME.
With no arguments, 'diary' toggles the current diary state.
See also: history.
 Additional help for built-in functions and operators is
 available in the online version of the manual. Use the command
 'doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
 at http://www.octave.org and via the help@octave.org
 mailing list.
 octave:6> diary off