user2908984
user2908984

Reputation: 3

converting object to string

I use this code for calling a matlab function in C#

Object b;
matlab.Feval("fun444",(int)1,out b,(double)(10));
label1.Text = b.ToString();`

it works and I could saw my answer in b using debugging mode . I want to display his number but it returns to me : system.object[] How can I display the double I saw in the debugger?

Upvotes: 0

Views: 93

Answers (2)

Kevin
Kevin

Reputation: 4636

You have an array instead of a single object.

You'll need to do something like this... Edit: I didn't see you were setting a textbox the first time I looked at your code.

label1.Text = b[0].ToString();

Upvotes: 1

Réda Mattar
Réda Mattar

Reputation: 4381

matlab.Feval gives you an array of one element, you can get it like this :

label1.Text = ((object[])b)[0].ToString()

Upvotes: 1

Related Questions