Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Passing options through user-defined functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58973] Re: Passing options through user-defined functions
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 26 Jul 2005 04:01:38 -0400 (EDT)
  • References: <dc1tg8$54u$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Joe,
optional arguments, denoted by name___ will do the trick. E.g.

  foo[p_,q_,opts___]:=
  Module[
  	{bar},
  	bar=Table[
  		f[x,y],
  		{x,1,p},{y,1,q}
  	];
  	ArrayPlot[bar,opts]
  ]

If you have options for different functions, may be you want to use the 
function
    FilterOptions
form the package:
    Utilities`FilterOptions`

Daniel

Joe Christy wrote:
> I have a function implemnted as module which uses various builtin
> functions. What is the best way to pass options to the builtin functions?
> 
> For example, I have something like
> 
> foo[p,q]:=
> Module[
> 	{bar},
> 	bar=Table[
> 		f[x,y],
> 		{x,1,p},{y,1,q}
> 	];
> 	ArrayPlot[bar]
> ]
> 
> and I would like to be able to write something like
> 
> foo[3,5, size -> 100]
> 
> and see the results of ArrayPlot[bar, ImageSize->{3*100,5*100}]


  • Prev by Date: Re: problem with Delete[]
  • Next by Date: Re: Passing options through user-defined functions
  • Previous by thread: Re: Passing options through user-defined functions
  • Next by thread: Re: Passing options through user-defined functions