help-octave
[Top][All Lists]
Advanced

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

Re: rename, save `whos`


From: John Smith
Subject: Re: rename, save `whos`
Date: Thu, 13 Jul 2000 19:23:47 +0100 (BST)

On Thu, 13 Jul 2000, Daniel Heiserer wrote:

> Hi,
> is there a way to rename a matrix.
> I mean a real "move" not a "copy" 
> and a delete.

> something like a 
> rename('oldname','newname');
> 

Yes - you get a rename for free!
To convince yourself, try

octave:1> a = rand(1000) ;    Create a 8M byte matrix ( takes a few seconds)
octave:2> size(a)             1000 x 1000 matrix
ans =

  1000  1000

octave:3> for n=1:10000       Make 10000 copies of it!
> eval(sprintf("a%d = a ;",n));         takes perhaps 30 seconds
> endfor
octave:4> a433(1,1)                Look at one element
ans = 0.64363
octave:5> a7453(1,1)               And the same element in another copy
ans = 0.64363
octave:6> who                      will show names of all copies!

And I promise I do not have 80 G bytes of memory!

John



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

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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