[問題] .NET 叫用 MATLAB DLL 的提示訊息

看板MATLAB作者時間11年前 (2014/01/13 22:40), 編輯推噓0(003)
留言3則, 1人參與, 最新討論串1/1
各位先進好 1. 我使用 MATLAB Builder NE 將我要用的 MATLAB 函式編譯成 DLL 檔 2. 在 Visual Studio 2010 的環境中使用 C# 叫用此 DLL。 使用的 MATLAB 函數為 lsqcurvefit 程式碼為 MATLAB 線上文件的範例,請參考說明中的 Example http://www.mathworks.com/help/optim/ug/lsqcurvefit.html 或是 --------------------------- myfun.m function F = myfun(x,xdata) F = x(1)*exp(x(2)*xdata); --------------------------- Untitled2.m % Assume you determined xdata and ydata experimentally xdata = ... [0.9 1.5 13.8 19.8 24.1 28.2 35.2 60.3 74.6 81.3]; ydata = ... [455.2 428.6 124.1 67.3 43.2 28.1 13.1 -0.4 -1.3 -1.5]; x0 = [100; -1] % Starting guess [x,resnorm] = lsqcurvefit(@myfun,x0,xdata,ydata); -------------------------------------------------------- 在 MATLAB 運行中出現下列提示訊息 (正常的) ----------------------------------------- Local minimum possible. lsqcurvefit stopped because the final change in the sum of squares relative to its initial value is less than the default value of the function tolerance. <stopping criteria details> Optimization stopped because the relative sum of squares (r) is changing by less than options.TolFun = 1.000000e-06. ------------------------------------------- 但是在 C# 運行中也出現此訊息 要如何讓 C# 運行中不出現此訊息呢? 請賜教。 感謝在先。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.68.239.53

01/13 23:25, , 1F
自問自答 在 MATLAB 中加上
01/13 23:25, 1F

01/13 23:25, , 2F
opts = optimset('Display', 'off');
01/13 23:25, 2F

01/13 23:26, , 3F
並修改 lsqcurvefit(@myfun,x0,xdata,ydata,[],[],opts)
01/13 23:26, 3F
文章代碼(AID): #1Iq_h7zg (MATLAB)
文章代碼(AID): #1Iq_h7zg (MATLAB)