Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 类型为';的未处理异常;System.Runtime.InteropServices.COMException';在c中使用MLApp时在mscorlib.dll中发生#_C#_Matlab - Fatal编程技术网

C# 类型为';的未处理异常;System.Runtime.InteropServices.COMException';在c中使用MLApp时在mscorlib.dll中发生#

C# 类型为';的未处理异常;System.Runtime.InteropServices.COMException';在c中使用MLApp时在mscorlib.dll中发生#,c#,matlab,C#,Matlab,我尝试在c#中使用以下matlab代码: c代码是: 但是,当我执行代码时,我的程序在matlab.Feval()上抛出以下异常: 有人能告诉我我做错了什么吗?以及如何修复它?将您的函数更改为使用:img=imread('F:\2dAutocorrelationFunction\New\u folder\1.bmp')。。。另一件事……您的代码是否在IIS中的Web服务/网站中运行?这可能是因为您没有访问该路径的权限。另外,请查看“InnerException”,它可能会为您提供更多错误信息。我

我尝试在c#中使用以下matlab代码:

c代码是:

但是,当我执行代码时,我的程序在matlab.Feval()上抛出以下异常:


有人能告诉我我做错了什么吗?以及如何修复它?

将您的函数更改为使用:img=imread('F:\2dAutocorrelationFunction\New\u folder\1.bmp')。。。另一件事……您的代码是否在IIS中的Web服务/网站中运行?这可能是因为您没有访问该路径的权限。另外,请查看“InnerException”,它可能会为您提供更多错误信息。我已将我的函数更改为您编写的函数,但它尚未运行。我不使用Web服务或网站,我使用windows窗体应用程序。InnerException不显示进一步的信息更改您的函数以使用:img=imread('F:\2dAutocorrelationFunction\New\u folder\1.bmp')。。。另一件事……您的代码是否在IIS中的Web服务/网站中运行?这可能是因为您没有访问该路径的权限。另外,请查看“InnerException”,它可能会为您提供更多错误信息。我已将我的函数更改为您编写的函数,但它尚未运行。我不使用Web服务或网站,我使用windows窗体应用程序。InnerException不显示进一步的信息
function [B] = AutoCorrelation()
img = imread('F:\\2dAutocorrelationFunction\\New_folder\\1.bmp');
img2 = rgb2gray(img);
[n m]=size(img2);
B=abs(fftshift(ifft2(fft2(img2).*conj(fft2(img2)))))./(n*m);
MLApp.MLApp matlab = new MLApp.MLApp();
matlab.Execute(@"cd 'F:\2dAutocorrelationFunction\New_folder'");
object result = null;
matlab.Feval("AutoCorrelation", 1, out result);
object[] res = result as object[]; 
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll