Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: matClose doesn't close file
Replies: 1   Last Post: May 13, 2011 8:39 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ray

Posts: 11
Registered: 7/6/08
matClose doesn't close file
Posted: May 13, 2011 5:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,

I'm using Win7-64-bit, Visual Studio 2010 Pro, and Matlab R2010b. I'm generating 32-bit code for everything and have written a C DLL that contains a function that creates a Matlab .mat file using the MATFile API functions. I use this DLL in a C# program. It creates the desired .mat file perfectly and the contents and readability by Matlab are also perfect. At the end of the creation process I call matClose to close the file and test its return value to make sure matClose was successful, and it does return a 0. However, after the DLL function returns to my C# code and it try to delete the .mat file that was just created, an exception is thrown that says that the file cannot be deleted because it is being accessed by another process. To test this another way I placed a breakpoint in my code just after the DLL function return and when the program paused I went to Windows Explorer and
tried to delete the file manually, but I got the same error about the file still being in use. Once I kill my entire application I can delete the file. I'm afraid that if I can't resolve this in a simple way my next step will probably be to try to unload then reload the entire DLL itself but I don't want to have do that because from what I've seen it's a real mess, plus I'm not sure that would solve the problem anyway. I would have actually preferred to use the CSMatIO .NET component rather than kluging together this C DLL, but I could never get it to work. Although it would seem to create a .mat file okay, Matlab couldn't read it.

Any ideas are welcomed,
Thanks,
Ray



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.