onedtond

Used to redimension singly dimensioned arrays as well as fill multi-dimensional arrays with singly dimensioned data.


Synopsis

	function onedtond(
		arg [*] ,
		dims : integer
	)

Arguments

arg
A singly dimensioned array of any length and type
dims
A singly dimensioned integer array of positive values that represents the desired output dimensionality.

Description

Converts any 1-dimensional array to a multidimensional array. The first parameter is the 1-d array and the second parameter is an array of output dimension sizes. If the product of the output dimension sizes is less than the number of elements in the input array a warning is printed but the output array is filled with as many values from the input as will fit. If the product of the output dimension sizes is greater than the input size then the input is repeatedly copied as many times as will fit. if the fit is uneven an error message is printed.

Example

The following simplistic examples demonstrate all of the possible cases for onedtond. Try running these examples and print out the values.
	a = (/1,2,3,4,5,6,7,8/)
;
; Basic case where input and output have same number of elements
;
	a0 = onedtond(a,(/2,4/))
;
; Case where there are twice the number of elements in the output
; as the input. In this case the values of a are copied twice
;
	a1 = onedtond(a,(/2,8/))

;
; Case where there are half the number of elements in the output
; as the input. In this case only the first four values of a
; are copied to the output.
; The following case generates a WARNING.
;
	a2 = onedtond(a,(/2,2/))

;
; Case where there are more elements in output than input but 
; number_output % number_input is not 0
; The following case generates a WARNING.
;
	a3 = onedtond(a,(/2,7/))



Reference Manual Control Panel

NG4.1 Home, Index, Examples, Glossary, Feedback, Ref Contents, Ref WhereAmI?


$Revision: 1.6 $ $Date: 1998/06/15 21:30:21 $