# Question:How to create a matrix with lists as elements?

## Question:How to create a matrix with lists as elements?

Maple

Absolute beginner here - please bear with me.

I would like to generate an 81 rows x 24 columns table from three nested "for" loops. I would like each entry of this table to be a list of 4 numbers. My code (which does not work) is as follows:

```local M, templist; for i to 81 do     for j to 24 do         for k to 4 do         M[i][j]:=[op(templist[k]), indice(C[i][1][k],rorder(orders[j],Sets[k]));];         end do;     end do; end do;```

In the above "indice" is a procedure that works fine and returns a number, and it works fine.

I would like the 4 numbers that are generated by the k loop to be stringed together into a list, so i thought I could use the temporary list "templist" to append to it the 4 numbers, which would then become the entry in row i and column j of matrix M, but it does not work, and instead I get a table of 81 tables. So for instance the first of these 81 tables is:

`1 = table([1 = [4, 1], 2 = [4, 1], 3 = [4, 2], 4 = [4, 3], 5 = [4, 2], 6 = [4, 3], 7 = [4, 1], 9 = [4, 1], 8 = [4, 1], 11 = [4, 1], 10 = [4, 1], 13 = [4, 2], 12 = [4, 1], 15 = [4, 2], 14 = [4, 3], 18 = [4, 3], 19 = [4, 2], 16 = [4, 2], 17 = [4, 3], 22 = [4, 2], 23 = [4, 3], 20 = [4, 3], 21 = [4, 2], 24 = [4, 3]])`

and I only have 2 values in each list, rather then the 4 I am after.

If I declare M as a 81x24 matrix, I get retunred a matrix of zeroes. Where am I going wrong?

If anyone could lend a hand, I'd be forever grateful. Thank you!

﻿