[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Load Command: Simple Problem, with a simple solution?

From: Douglas Eck
Subject: Re: Load Command: Simple Problem, with a simple solution?
Date: Fri, 26 Jan 2001 10:23:52 +0100

Hi Martin,
At least two issues are at play. 
First, octave does not keep track of data files in the
same way it keeps track of .m files. 

Octave >> ls
myFun.m     myData.mat

Octave >> which myFun
myFun is the user-defined function from the file

Octave >> which myData.mat
which: `myData.mat' is undefined

So you'll have to give the load command the full path to your

Second, load() expects by default a binary file format specific
to Octave (and identical under certain conditions to that 
of Matlab). Try "help load" to see other possible formats

The following example will write a single vector with
values [1 2 3 4] the file myData.mat. loading the file
restores the vector (as variable a)

a=[1 2 3 4]
save 'myData.mat' 'a'
clear *
error: a undefined near line 9 column 1
load 'myData.mat'

PS You can build your own text files if you want to bypass
the binary file format. The command

save -ascii 'myData.txt' 'a'

Yields a text file with enough information to recreate the saved
vector 'a':

# Created by Octave 2.1.32, Fri Jan 26 10:21:30 2001 CET <address@hidden>
# name: a
# type: matrix
# rows: 1
# columns: 4
 1 2 3 4

Hope that helps!

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]