Loading your work

Let us see how one can load the variable(s) stored in a file. First, we clear the workspace to be sure that we actually load the variable prime_sequence stored in the file primes.mat:

octave:46> clear; whos

octave:47> load primes.mat

octave:48> whos

Variables in the current scope:

Attr    Name               size            Bytes   Class  

====    ====               ====            =====   =====

prime_sequence             1x1385          11080   double

Notice that Octave treats the numbers as doubles, since we have not explicitly told it otherwise.

The general syntax for load is:

load –option1 –option2 filename

where the options are the same as above for the save command. For example, to load the data stored in the ascii file primes.dat, we can use:

octave:49> load –ascii primes.dat octave:50> whos Variables in the ...

Get GNU Octave now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.