Convert a list to an array

Hi guys, I have a doubt. How can I convert a list to a 100x100 matrix?
I have the following code where I extract a text of floating numbers in a list:

def parseA() do
{:ok, contents} =“MatrizA.txt”)
contents |> String.split("\t", trim: true) |> n -> {v, _} = Float.parse(n); v end)

but now I want to transform that list into a matrix. How can I do it? if you can help me!

You may have to be a little more specific.

Do you just want each consecutive group of 100 elements to be a new column?

Or are there other criteria for splitting up the initial list.

An example of the data and your desired output would be helpful.

If it’s the first case, Enum.chunk_every/4 is probably what you want,

1 Like

Thanks, This was what i meant

If you did want to do custom “chunking”, you could use Enum.chunk_by and provide your own function to do the “chunking”