transpose function
Syntax
float[]/string[]/bool[] transpose(array)
Parameters
- array (float[], string[], bool[])
Array to be transposed.
Returns
The transposed array.
Description
The transpose function transposes an array of any type.
array = |
["a","b"; "c","d"; "e","f"] |
transpose(array) |
["a","c","e"; "b","d","f"] |
Related
- Array types operators
- array initialization function
- size function
- nColumns function
- nRows function
Examples
Zipping
const a = [1,1,1] const b = [2,2,2] const c = transpose([a ; b]) // [1,2 ; 1,2 ; 1,2] const d = c[0 : size(c)-1] // [1,2 , 1,2 , 1,2]Two 1d arrays a and b are zipped, i.e. a new array is constructed that contains the elements of both arrays in an alternating manner. To do so a combination of a and b is transposed and linearly indexed.
const c = [transpose(a) , transpose(b)] // [1,2 ; 1,2 ; 1,2] const d = c[0 : size(c)-1] // [1,2 , 1,2 , 1,2]Alternatively, the arrays can be transposed first and combined.
Copyright ©2008-2024 Esri R&D Center Zurich. All rights reserved.