lettura simple

How to Record an Octave Session in a File

In this lesson, I explain how to record in a file the sequence of commands you type during an Octave session.

What is it for? This feature is useful for recording the commands typed on the console in a text file. This way, you can also check later which command sequences you typed on the console.

To start recording, type diary on

>> diary on

This command starts recording commands to the diary file in the Octave working directory.

Now type some commands in the session.

>> a = 1
a = 1
>> b=2
b = 2
>> c=a+b
c = 3

To end the recording, type diary off

>> diary off

In the Octave working directory, you will find a diary file. If you open it, you will see the sequence of commands that you typed on the console during the recording.

How to start recording to a different file

To start recording using a different file instead of diary, type:

>> diary nomefile

Where 'filename' is the name of the text file in which you want to record the session. The functionality is the same as before, but Octave writes a copy of the commands to the file that you have specified instead of the diary file.

To end the recording, use the command diary off.

>> diary off

Once the recording is complete, open the file that you have specified. Within the file, you will find all the commands typed during the recording.




Report a mistake or post a question




FacebookTwitterLinkedinLinkedin