E
eric_jin
i wrote a c# webservice to call matlab functions.
add is the function written in matlab,and then make it dll to use in c#;
//add.m
function result=add(left,right)
result=left + right;
//end of add.m
//calling add in c#
[webmethod]
public double add(double left,double right)
{
fun.funClass st=new fun.funClass();
object b=new object();
st.add(1,ref b,left,right); //$breakpoint here;
double c=(double)b;
return c;
}
but this returns an error in c# where left is set to 4 and right is 5;
when i set a breakpoint in line$;it showed that b is of value 9,which means
the function was correctly
called from matlab;
but when i tried to transform object b to double-tpye,
//double c=(double)b;
it returns an error;
could anybody please tell me why it can not work?
add is the function written in matlab,and then make it dll to use in c#;
//add.m
function result=add(left,right)
result=left + right;
//end of add.m
//calling add in c#
[webmethod]
public double add(double left,double right)
{
fun.funClass st=new fun.funClass();
object b=new object();
st.add(1,ref b,left,right); //$breakpoint here;
double c=(double)b;
return c;
}
but this returns an error in c# where left is set to 4 and right is 5;
when i set a breakpoint in line$;it showed that b is of value 9,which means
the function was correctly
called from matlab;
but when i tried to transform object b to double-tpye,
//double c=(double)b;
it returns an error;
could anybody please tell me why it can not work?