[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: save;load question
From: |
Geraint Paul Bevan |
Subject: |
Re: save;load question |
Date: |
Fri, 17 Dec 2004 20:47:53 +0000 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040306) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
D Goel wrote:
| So, how do i extract the actual value of the matrix inside the program
| from this structure? (Note that the program does not know that the
| name of the variable is M).
You can loop over the structure using the "for [val, key] = structure"
construct.
octave> M = [ 1, 2 ; 4 , 3 ]
M =
~ 1 2
~ 4 3
octave> save ( "file.dat", "M" )
octave> data = load ( "file.dat" )
data =
{
~ M =
~ 1 2
~ 4 3
}
octave> for var = data; endfor
octave> var
var =
~ 1 2
~ 4 3
- --
Geraint Bevan
http://homepage.ntlworld.com/geraint.bevan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iEYEARECAAYFAkHDRfgACgkQcXV3N50QmNM7OwCfRRy1HaiI7pROE9tzUh0vAISJ
XzUAnj40SSefS4JHDwiZoGD4Owk+zCoW
=nB8Z
-----END PGP SIGNATURE-----
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------