Vromoturion

i want to read data from a txt file stored in sd card with arduino(uno)the file structure is like this:[2 2 3 4 53 1 5 8 24 4 5 6 74 5 6 8 1]and then to store the values in an array (matrix, for this example a matrix[4][5])to use them in functions.is there a command i can use or some code to do so? if convinient explain pleaseif it is more helpful i will use comma seperated valuesany suggestions acceptable...

You really don't need to have any structure to the file if all you are doing is saving a bunch of numbers, as how you read them in creates the structure in the code. I would not bother with the '[' and ']'. I am assuming you know how to open a file for reading or can at least find out.

if end-of-file return(0);read characters while they are not a numbernum = character - '0'; // this creates a single digit number from the ASCII characterwhile the characters are numbers num = (num * 10) + character - '0';return(num);

You may also find a function in the SD library that you are using that could read the next number for you - that depends on the library.

To write the numbers is very similar - use the loop and write the values instead of reading them.