Re: keyword params in HISTOGRAM [message #7540] |
Thu, 21 November 1996 00:00 |
chs11
Messages: 14 Registered: October 1995
|
Junior Member |
|
|
In article <329392F4.1A80@shapley.colorado.edu>,
Mark Fardal <fardal@shapley.colorado.edu> wrote:
> However, when I try to pass HISTOGRAM a keyword parameter that's
> undefined, I get an error message. The routine here is just a
> wrapper function for HISTOGRAM, so I want to pass a number of
> keyword parameters through to it.
>
> function histomake, array, binsize=binsize, xpoints=xpoints, $
> input=input, min=min, max=max, omin=omin, omax=omax, reverse=reverse
> [...stuff deleted...]
>
> n = histogram(array, binsize=binsize, min=min, max=max, $
> omin=omin, omax=omax, reverse=reverse)
>
> [...stuff deleted...]
> return
> end
This doesn't work because you can't assign an undefined variable
to a new variable name. It has little to do with the function call
but is as simple as the following eroneous code:
IDL> a = b ; where b is undefined!
Anyhow, the solution to your problem is the use the _EXTRA keyword.
_EXTRA is a structure that contains all keywords that are not
explicitly defined in a procedure definition. You use it as follows:
function histomake, array, _EXTRA = EX
n = histogram(array, _EXTRA = EX )
return
end
IDL> a =histomake(b,max=23)
Here, the max parameter is not recognized by histomake, so it sends it
on to histogram.
Hope this helps.
Carl
|
|
|