09-18-2021, 05:30 AM
Yes, QM does not have array initializers. Can be used CSV.
Function InitArray_int_2D
Function InitArray_int_2D
;/
function $csv ARRAY(int)&a
;Creates ARRAY(int) of 2 dimensions (columns, rows) from a CSV string.
;EXAMPLE
;str csv=
;;1,2, 3,4
;;5,6, 7,8
;;9,10, 11,12
;;13,14, 15,16
;ARRAY(int) a
;InitArray_int_2D csv a
;
;;results
;int row
;for row 0 a.len
,;out F"{a[0 row]},{a[1 row]}, {a[2 row]},{a[3 row]}"
ICsv c._create
c.FromString(csv)
a.create(c.ColumnCount c.RowCount)
int i j
for i 0 a.len
,for j 0 a.len(1)
,,a[j i]=c.CellInt(i j)