[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
maintain state in between oct file calls
From: |
John W. Eaton |
Subject: |
maintain state in between oct file calls |
Date: |
Thu, 20 Apr 2000 03:56:32 -0500 (CDT) |
On 20-Apr-2000, Daniel Kottow <address@hidden> wrote:
| i am not sure if this is an octave specific question, but it was under
| matlab. suppose i have a compiled function (oct function) and want to
| keep some data between successive calls to it. this may be useful if the
| oct file needs a complex internal structure and you want to analyze
| parts of it in the octave environment. i used to do neural networks this
| way. then i could do the following:
| octave:> backprop('init', init_param1, init_param2...);
| octave:> backprop('train', training_data);
| octave:> w = backprop('getWeights');
| octave:> plot(w);
| octave:> backprop('train')...
| octave:> ...
| octave:> backprop('clean');
|
| just a suggestion. but how do you make backprop.oct keep its
| variables?
Declaring them static should work.
| under matlab there were specific memory allocating functions, something
| like matlab_static_alloc() which did the job (matlab would then be able
| to clean up at the end of a session if the user didnt).
Why would that be needed? When a program exits, a reasonable OS
reclaims allocated memory even if it isn't explicitly freed.
jwe
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------