export an array of variable depth
- To: mathgroup at smc.vnet.net
- Subject: [mg83611] export an array of variable depth
- From: Chris <zaeggi at gmail.com>
- Date: Sun, 25 Nov 2007 04:28:31 -0500 (EST)
Dear all, We're having quite a similiar problem to a post that was made last june: http://forums.wolfram.com/mathgroup/archive/2006/Jun/msg00398.html We want to send a multidimensional array from Mathematica to a C-Programm (over Mathlink) that uses this data as input. At the moment we're struggling with the "Pattern:"-command in the template file. Since we're passing lists of lists (array) of Real values to our programm but don't know the depth of this list in advance (the actual user enters the depth), this forms our problem. How is it possible to write such a 'Pattern:...' ? Any insights on that one? Our .tm-file for only 2 'inner lists' looks as follows: ******************** // tm-file :Begin: :Function: Sample // how can we make this more dynamic? We want to be able to determine the number of inner lists ourselves, maybe with an additional parameter? :Pattern: Sample[list:{one:{___Real},two:{___Real}}] :Arguments: {list} :ArgumentTypes: {Manual} :ReturnType: Manual :End: ******************** This acutally works but doesn't let us leave with much of flexibility. Does anyone have a solution to this one? Any help is greatly appreciated! Regards, Chris