You say "matrix", but do you actually mean array? How does the data come in from the serial port? One at a time for each component? Look at the array functions. Do you want a 1-D array or 2-D array? What is the format of this array? You will probably want to use build array, or send the strings to the edge of the For or while loop and turn on autoindexing.