Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to pass an object of LinearModel Class as output to a .Net Interface ?

1 visualización (últimos 30 días)
Rahul Sivagaminathan
Rahul Sivagaminathan el 22 de Ag. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 ?

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by