Prev: create a new column vector
Next: integers to strings
From: minibela on 12 May 2010 13:34 Hello, Similar problem here. My .NET project referencing a dll file that wraps three Matlab functions works fine with other .NET projects of my applications but when I want to test it with a unit test project it fails with the following error message: "Test method Matlab.Tests.StatisticalToolboxTests.TestDistribustions threw exception: System.TypeInitializationException: The type initializer for 'Matlab.Stat.Distributions' threw an exception. ---> System.TypeInitializationException: The type initializer for 'StatTools.MFunc' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.." The C# code is: public static class Distributions { private static StatTools.MFunc cdf; // cumulative distribution functions static Distributions() { cdf = new StatTools.MFunc(); } .... } StatTools.dll has been generated with deploytool in Matlab. I don't believe that I'm missing some references. Then what's wrong? Any idea?
From: minibela on 12 May 2010 14:36 I'm back with a solution to my problem, maybe one day it will help someone to fix her/his issue. So, when you plan to use Matlab within .NET, two files are essential, dll and ctf. If you add the dll file to your project references and run the application, you'll find the ctf file under bin\Debug along with the dll (I don't know why) For a unit test project, it seems that you have to deploy the ctf file into the testing directory by yourself (for example using testrunconfig) Now this looks obvious to me, although I spent one whole day to learn it :) Have a nice day!
From: minibela on 12 May 2010 14:47 I'm back with a solution to my problem, maybe one day it will help someone to fix her/his issue. So, when you plan to use Matlab within .NET, two files are essential, dll and ctf. If you add the dll file to your project references and run the application, you'll find the ctf file under bin\Debug along with the dll (I don't know why) For a unit test project, it seems that you have to deploy the ctf file into the testing directory by yourself (for example using testrunconfig) Now this looks obvious to me, although I spent one whole day to learn it :) Have a nice day!
|
Pages: 1 Prev: create a new column vector Next: integers to strings |