my program stops working after adding a matlab .net assembly to the program
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have created a .net program that reads data from a data-acquisition system and saves it to a file. Each second data is read and saved to a dataset in an hdf-5 file. The program works until I add a matlab .net assembly to the program. When I create the matlab object and start reading in the data and writing it to a file I get an exception when saving the data.
- I do get a message in the Output window when the matlab instance is initiated that says: "Current directory: D:\Matlab\work\Compiler\Cardiovascular" This directory is the directory of the matlab project where the .net assembly is created
- The matlab instance is created when the program starts. No function of the matlab instance is yet called in the program.
- The matlab instance works when I do unit tests on it.
Does anyone have an idea how creating a matlab instance can influence saving data to a file?
0 commentaires
Réponses (1)
Sanket Karnik
le 15 Fév 2017
I understand that you are getting an exception while writing data to file if you initialize a MATLAB .NET assembly. Since you have mentioned that you are getting a message saying 'Current directory = < path of the directory where your assembly was created >' it might be possible that your program might have navigated to that directory. If you are using a relative path to write data to a file and if the program navigates to a different directory then it won't be able to find the file and it might have caused the issue. One of the possible reasons behind the change in directory is, you may have a 'cd' command in the code which you converted into .Net assembly or you may have a startup.m file which has a 'cd' command which may have caused the issue. I hope it helps you but it will be easier for us to answer the question if we knew the exact error message. Hence if this does not resolve the issue, please provide exact error message, and let us know if you are using relative or absolute path to write to the file. Also, if you are using relative path please try using absolute path and see if the issue is still there.
Regards,
Sanket
0 commentaires
Voir également
Catégories
En savoir plus sur Package MATLAB Functions dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!