Function Reference


_ArrayTranspose

Transposes a 1D or 2D array (swaps rows and columns)

#include <Array.au3>
_ArrayTranspose ( ByRef $aArray )

Parameters

$aArray Array to modify

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero.
@error: 1 - $aArray is not a 1D or 2D array
2 - $aArray is not an array

Related

_ArraySwap

Example

#include <Array.au3>

Local $aArray[3][2] = [[1, 2], [3, 4], [5, 6]]
_ArrayDisplay($aArray, "Original")
_ArrayTranspose($aArray)
_ArrayDisplay($aArray, "Transposed")

Local $aArray[5] = [1, 2, 3, 4, 5]
_ArrayDisplay($aArray, "Original 1D")
_ArrayTranspose($aArray)
_ArrayDisplay($aArray, "Transposed to 2D")
_ArrayTranspose($aArray)
_ArrayDisplay($aArray, "Re-transposed to 1D")