.net - Call Matlab Function from C# error : The type initializer for 'tes.tambah' threw an exception -
i getting
"the type initializer 'tes.tambah' threw exception.."
using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using mathworks.matlab.net.arrays; using tes; namespace panggil_lib_matlab { public partial class form1 : form { public form1() { initializecomponent(); } private void button1_click(object sender, eventargs e) { tambah tbh = new tambah(); } } }
and matlab code:
function [ hasil ] = coba( a,b ) hasil = a+b; end
i error on line: tambah tbh = new tambah();
, 'innerexception' message:
system.typeinitializationexception: type initializer 'mathworks.matlab.net.utility.mwmcr' threw exception. ---> system.typeinitializationexception: type initializer 'mathworks.matlab.net.arrays.mwarray' threw exception. ---> system.badimageformatexception: attempt made load program incorrect format. (exception hresult: 0x8007000b) @ mathworks.matlab.net.arrays.mwarray.mclmcrinitialize2(int32 primarymode) @ mathworks.matlab.net.arrays.mwarray..cctor() --- end of inner exception stack trace --- @ mathworks.matlab.net.utility.mwmcr..cctor() --- end of inner exception stack trace --- @ tes.tambah..cctor()
i use:
- windows 8.1 64-bit
- visual studio ultimate 2012 (32-bit, think)
- matlab r2015a 64-bit
can me?
make sure application targets x64 rather anycpu
Comments
Post a Comment