"clear mex" in octave?

Ben Abbott bpabbott at mac.com
Fri Feb 20 10:57:01 CST 2009


On Friday, February 20, 2009, at 08:53AM, "Joris Mooij" <joris.mooij at tuebingen.mpg.de> wrote:
>On Fri, Feb 20, 2009 at 07:34:32AM -0500, Ben Abbott wrote:
>> On Feb 19, 2009, at 8:58 AM, Joris Mooij wrote:
>>
>>> Hi all,
>>>
>>> does anybody know why octave does not automatically reload a mex file
>>> when I recompile it (using "mkoctfile --mex filename.cpp")? The only
>>> way I get octave to use the new .mex file is to restart octave, which
>>> is not very practical (in matlab, MEX files are reloaded  
>>> automatically).
>>> Even "clear mex" or "clear all" would not reload the mex files in
>>> octave.
>>>
>>> Thanks for your help,
>>> Joris
>>
>> Are you saying that when running Matlab, "clear mex" actually reloads  
>> mex files?
>>
>> Are you sure?
>>
>> Ben
>
>Actually I have never tried "clear mex" in Matlab, because Matlab
>automatically reloads mex files when they are recompiled... at
>least when the Matlab command prompt is shown.

In my experience, Matlab does not load mex-files until they are needed (i.e. run).

>So I am not sure whether "clear mex" actually reloads mex files in
>Matlab. However, according to the Matlab documentation for 7.0.1
>(R14SP1) [1], it should.

The link you provided says: "The command clear mex now clears MEX-functions, but not M- and MEX- functions. Entering clear mex does not clear locked functions or functions that are currently in use. It does however clear breakpoints and persistent variables."

I may be wrong, but it does not appear to me that Matlab loads a mex file (dll on windows) until it is needed.

>My actual question is about how to reload mex files in octave after
>they have changed on disk.

You should only need to run them. However, the mex file will need to be in your path.

If my understanding is wrong, I expect someone will correct me shortly.

Ben




More information about the Help-octave mailing list