MGH_REPRODUCE Name
MGH_REPRODUCE Purpose
Replicate by example: replicates a scalar value into an array
(or scalar) with size & dimensions copied from a template
array. Useful for generating structure arrays in procedures.
Category
Array manipulation. Structures.
Calling Sequence
Result = MGH_REPRODUCE(value, template)
Positional Parameters
value (input, any type and size)
Data to be replicated. Dimensions are ignored and only the first
element is used.
template (input, any type and size)
Supplies dimensions. Return Value
This function returns a variable with the same type as Value and the
same organisation as Template.
###########################################################################
This software is provided subject to the following conditions:
1. NIWA makes no representations or warranties regarding the
accuracy of the software, the use to which the software may
be put or the results to be obtained from the use of the
software. Accordingly NIWA accepts no liability for any loss
or damage (whether direct of indirect) incurred by any person
through the use of or reliance on the software.
2. NIWA is to be acknowledged as the original author of the
software where the software is used or presented in any form.
###########################################################################
Modification History
Mark Hadfield, Oct 1993:
Written, based on ideas in one of Bill Thompson's procedures.
Mark Hadfield, Jun 1995:
Modified to treat one-element template arrays correctly.
Mark Hadfield, 2003-08:
Simplified this routine substantially using newer IDL type inquiry and
creation functions.