Re: J/Link
- To: mathgroup at smc.vnet.net
- Subject: [mg26715] Re: J/Link
- From: tgayley at wolfram.com (Todd Gayley)
- Date: Thu, 18 Jan 2001 00:57:18 -0500 (EST)
- Organization: Wolfram Research, Inc.
- References: <943c20$cfg@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 17 Jan 2001 00:54:08 -0500, Edd klemens <morlan14 at yahoo.com> wrote:
>Dear Friends
>i want to send the contents of an array variable in VB
>to Mathematica by using something like the following
>single line:
>link.evaluateToOutputForm("Plus[" & ArrayVariable &
>"," & 2 & "]", 0)
>but it did not work unless i send it piece by piece
>Best Regards
>Ed. klemens
Ed,
I'm not aware of a built-in way to convert a VB array to a string (the & operator doesn't
do it), and even if there was, it wouldn't be likely to produce a string in Mathematica
InputForm. You can either stringify your array yourself:
s = "{"
For Each i In ArrayVariable
s = s & i & ", "
Next
s = Left(s, Len(s) - 2) & "}"
or, better, pass the input as an expression rather than as a string:
link.putFunction "Plus", 2
link.put ArrayVaraible
link.put 2
If you put the expression piecemeal like this (rather than making it into a string), you
cannot use evaluateToOutputForm, and you result will come back as an array not as a string
(but this is probably what you want anyway).
--Todd