MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MapThread error with NET/Link function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85343] Re: MapThread error with NET/Link function
  • From: dh <dh at metrohm.ch>
  • Date: Thu, 7 Feb 2008 04:38:48 -0500 (EST)
  • References: <fo9gkh$slf$1@smc.vnet.net>


Hi Yvon,

I do not know why you need to specify arguments. But your syntax is 

certainly wrong:

MapThread[dataSet@SetClusterIds[#1&,#2&],{recordId,clusterIds}]

should read:

MapThread[dataSet@SetClusterIds[#1,#2]&,{recordId,clusterIds}]

hope this helps, Daniel



Yvon wrote:

> I have created a .NET library (using C#) that I'm using in

> Mathematica.  I have the following method defined in a Data class:

> 

>         public void SetClusterIds(long recordId, int[] clusterId)

> 

> In Mathematica when I do the following, the method works as expected:

> 

>     dataSet = NETNew["TestLib.Data"]

>     ...

> 

>     dataSet@SetClusterIds[5577,{1,2,2,2,2,0,0,0,0,0}]

> 

> 

> If I then have a one dimensional array recordId = {5577,5576,5575} and

> a two-dimensional array clusterIds = {{1,2,2,2,2,0,0,0,0,0},

> {1,2,1,2,1,0,0,1,1,2},{1,0,2,2,2,2,2,2,0,0}} in Mathematica and try to

> do a MapThread to the .NET method above:

> 

>    MapThread[dataSet@SetClusterIds[#1&,#2&],{recordId,clusterIds}]

> 

> I get the following error:

> 

> NET::methodargs: Improper arguments supplied for method named

> SetClusterIds.

> 

> {$Failed[5577, {1, 2, 2, 2, 2, 0, 0, 0, 0, 0}], $Failed[ 5576, {1, 2,

> 1, 2, 1, 0, 0, 1, 1, 2}],

> $Failed[5575, {1, 0, 2, 2, 2, 2, 2, 2, 0, 0}]}

> 

> The $Failed arguments look like what I want for input into the method,

> which is puzzling.

> 

> (I've also tried MapThread[dataSet@SetClusterIds,

> {recordId,clusterIds}] but the error then says there are not enough

> parameters supplied, or something to that effect...)

> 

> Does MapThread not work for NETLink methods? Or does my .NET class

> method need to be structured differently to get it to work with

> MapThread?

> 

> Thanks in advance for your help!

> 

> Yvon

> 




  • Prev by Date: Re: Mathematica 6.0.0 no graphics output on Windows XP
  • Next by Date: Re: Displaying Real Numbers
  • Previous by thread: MapThread error with NET/Link function
  • Next by thread: Re: MapThread error with NET/Link function