How can I get one array like table?
First, put your columns into an array:
$id=@(1,2,3)
$name=@('Mark','Revekka','Johan')
$Height=@(190,'',178)
$columns = @($id, $name, $Height)
Now you can access second column in second row:
$columns[1][1] # prints 'Revekka'
If you want an actual table:
$lastColumnIndex = $columns.count - 1
$lastRowIndex = $columns[0].count - 1
0..$lastRowIndex | % {
$currentRow = $_
0..$lastColumnIndex | % {$columns[$_][$currentRow]} | Join-String -Separator "`t"
} -OutVariable myTsv
It will produce desired output:
1 Mark 190
2 Revekka
3 Johan 178
You can add a line with column names: $myTsv = "id`tname`theight", $myTsv:
id name height
1 Mark 190
2 Revekka
3 Johan 178
Now, since it's a valid Tsv, you can parse it into an array of PSCustomObject's:
$myTsv | ConvertFrom-Csv -Delimiter `t -OutVariable array
...
id name height
-- ---- ------
1 Mark 190
2 Revekka
3 Johan 178
Now finally you can get information as you've desired:
$array[1].name # prints Revekka
$array[1].name. You could have a 1-d array of objects which would have names, but that isn't a 2-d array. Either way you can't add rows like['Helena',168]because where's the ID? And it's not clear whether you mean$array[1]to be an array index (element 2) or an ID lookup (element ID==1) - for that to happen it would need to be a dictionary of dictionaries. You can have any of them, but you can't have all of them because they don't make sense together.