Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make GNU octave reload scripts each time they are run

Tags:

octave

I have a problem where Octave does not execute the newest version of recently edited scripts or functions if the working directory is a network drive. I have looked into it and it seems that Octave decides whether to reload these files based on the time stamp, and on my network for whatever reason the time stamps are very slow to update. MATLAB doesn't have this problem, nor does any other program for that matter. I'm running the MXE build of Octave for Windows 3.8.2.

Currently my only workaround is to close and re-open Octave each time I edit a file. This is obviously not convenient. I would like to set Octave to simply reload files when they are executed regardless of the dates, but I haven't found a way to do this. I'm hoping people here might have some ideas.

like image 919
AMTK Avatar asked Mar 06 '15 17:03

AMTK


People also ask

How do you return in Octave?

Returning From a Function Unlike the return statement in C, Octave's return statement cannot be used to return a value from a function. Instead, you must assign values to the list of return variables that are part of the function statement.

How do you stop an infinite loop in Octave?

To stop a running command or script in octave GUI or prompt: Ctrl + C.

How do I create an M file in Octave?

Simply type the filename without extension . Type run("filename. m") in the command line of Octave . Then press ctrl + c to exit the file in middle of the run .


1 Answers

(Seems to does not work: You can use rehash this will Octave reinitialize its directory cache, see http://octave.sourceforge.net/octave/function/rehash.html).

You can also use clear functionName which should clean all variables in the function and trigger a reload (you script would be called functionName.m).

I got this from the Octave mailing list: http://lists.gnu.org/archive/html/help-octave/2009-03/msg00212.html

like image 67
usr1234567 Avatar answered Oct 05 '22 22:10

usr1234567