From: Norman on
Hi!

Can matlab be ordered to release file handles of once uses
mexw32 files automatically after using them?

I use process models for calculations and to improve the
calculation speed I want to use c-files and two CPU cores
(with two matlabs running at the same time). Say I used
models 1 to 5 (and in doing so the mex-files for these
models were needed), then I go on with models 6+. Now I want
to re-compile models 1-5 with the new informations I got
with the second matlab. But all I get is a sharing
violations since the first matlab has not closed the file
handles.

Matlab commands:
> mex -inline -O -output mex_timeupdate_Modell_51_VPAR (...)

cannot open output file mex_timeupdate_Modell_51_VPAR.mexw32:

C:\PROGRA~1\MATLAB\R2007B\BIN\MEX.PL: Error: Link of
'mex_timeupdate_Modell_51_VPAR.mexw32' failed.

I used a file monitor programm to see what's the real cause
of this error. And it's the attempt of lcclnk.exe to create
the mentioned file, resulting in a SHARING VIOLATION.

Any idea how to close such file handles (but not manually)?

From: Steven Lord on

"Norman " <norman.nospam.violet(a)tu-berlin.de> wrote in message
news:fvp7oc$rll$1(a)fred.mathworks.com...
> Hi!
>
> Can matlab be ordered to release file handles of once uses
> mexw32 files automatically after using them?
>
> I use process models for calculations and to improve the
> calculation speed I want to use c-files and two CPU cores
> (with two matlabs running at the same time). Say I used
> models 1 to 5 (and in doing so the mex-files for these
> models were needed), then I go on with models 6+. Now I want
> to re-compile models 1-5 with the new informations I got
> with the second matlab. But all I get is a sharing
> violations since the first matlab has not closed the file
> handles.

Try to use the CLEAR function with the name of the MEX-file to clear the
MEX-file from memory, or use "clear functions" to clear all M-file functions
and MEX-functions from memory.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/clear.html

--
Steve Lord
slord(a)mathworks.com


From: Norman on

> Try to use the CLEAR function with the name of the
MEX-file to clear the
> MEX-file from memory, or use "clear functions" to clear
all M-file functions
> and MEX-functions from memory.

Thank you very much!

For example ..

"clear mex_timeupdate_Modell_1.mexw32"

did the job.

Thanks again!

Norman