Where to put the files which dll will use?

Hello!

I have another question again. I have created a Matlab Com Dll with matlab's tool "comtool", this dll will read some input files in the current directory and do some computation. I can run the matlab .m file correctly in Matlab. Now I want to call this dll in Visual Basic. I have successfully register the Dll and other things related with the Dll correctly in the visual basic program.  When I tried to run the visual basic program, it seems my Dll worked and tried to open those files. But I get an error "can't open file xxxx.txt", where xxxx.txt needs to be opened by the Dll.

I have put those files in the same directory where my DLL located, or my visual basic program located, or c:\windows\system, or c:\windwos\system32. But I still get that error.

Could someone tell me how to solve this problem?

Thanks a lot.
yangyeAsked:
Who is Participating?
 
Arthur_WoodConnect With a Mentor Commented:
Does the MatLab documentation have any information about where the file is to be located.  I would contact the Mathworks (vendor of MatLab) at

http://www.mathworks.com/support/

and see it they can shed some light on whre to place the file.

AW

0
 
Arthur_WoodCommented:
try putting the file in the same directory where your VB.EXE is located.

It would appear, if the error message simply names the file, without any path, that the file is assumed to be 'local' - that is, in the directory from which the program is executing.

AW
0
 
yangyeAuthor Commented:
Thanks Arthur_wood. But it is regret that I still haven't solved the problem yet. My VB is a visual basic macro in the Excel and I don't have a separate visual basic software. I searched the directory of the Excel.exe and put the files there, and I still got the same error. I tried to search VB.exe but didn't find it. Any more suggestions?

Thanks.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
yangyeAuthor Commented:
Sorry, the error message includes the directory name, like can't open c:\temp\test.txt

Could someone help me what's wrong with my program?
0
 
yangyeAuthor Commented:
And I had put that file, i.e., test.txt in the directory of c:\temp, but still get the error message
0
 
yangyeAuthor Commented:
Thank you, AW. I will contact Matlab. I am still working on the problem now.
0
 
yangyeAuthor Commented:
I have contacted the Matlab technical support and known from them that this problem was caused by the limitation of their compiler. Since I used "load("xxxx.txt") " in my Matlab .m file to load the data, where Matlab C compiler doesn't support ASCII file for loading the data. I can use other functions of Matlab such as fopen, fread, or I can use load("xxxx.mat") format ot solve this problem, where .mat file is a binary file rather than ASCII file.
0
 
Arthur_WoodCommented:
never having used, (or needed to use for that matter) Matlab, what you said means almost NOTHING to me, but it it makes sense to you, then great.

AW
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.