Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to pass an object of LinearModel Class as output to a .Net Interface ?
1 次查看(过去 30 天)
显示 更早的评论
I have a function that i am compiling using Matlab Compiler (to create a DLL for .Net Assembly). The function uses the input and develops a Linear model using stepwise regression. Here is the code
function [Rsq,Mdl] = DevelopModels(Input,Output)
Mdl = LinearModel.stepwise(Input,Output,'linear','verbose',0);
Rsq = Mdl.Rsquared.Ordinary ;
end
I then compile this function using Matlab compiler into a DLL for .Net Assembly. Here is the code in C#
CollectData cd = new CollectData();
int[,] designSamples = new int[,]
{
{ 0, 10 ,5 ,150},
{ 0 , 205,25 ,125 },
{ 0 ,400 ,5 , 100 },
{ 50 ,10 ,15 , 100 },
{ 50 ,400 ,25 , 150 },
{ 100 ,10 ,25 , 150 },
{ 100 ,205 ,15 , 150 },
{ 100 ,400 ,5 , 125 },
{ 100 ,400 ,25 , 100 },
{ 100 ,10 ,5 , 100 },
};
int[] exampleRankings = new int[]
{
2 ,
3 ,
6 ,
4 ,
7 ,
6 ,
5 ,
8 ,
8 ,
5
};
MWNumericArray designSamplesMW = new MWNumericArray(designSamples);
MWNumericArray rankingsMW = new MWNumericArray(exampleRankings);
MWArray[] models = cd.DevelopModels(2, designSamplesMW, rankingsMW);
On the .Net side when i try to use this DLL, i get proper values in Rsq but Mdl is returned as NULL. What am i doing wrong ? Can i not return mdl as output to .NET ?
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!