Hi, everyone.
I've been testing the SdFat library for csv file.
I have an input data of temperature, one data for one day. I save it in SD card and I can read the data in the file.
When I read the file, all the saving data will be read. The problem is, for some reason I need to read only a certain data; for example, from row two until row ten (data day 2 until data day 10). This statement is part of the program and does not change. Besides, I need to calculate the mean of all the data in that file. I have tried to code like [ mean = avg(file.csv)], but this cannot be done with an error.
So, I need a guide on how can I read and calculate the mean of the chosen rows in the .csv file.
Thanks.
You have to start at the beginning of the file and read all the rows, ignoring those rows that are not to be included in the calculation.
Life can be easier with fixed width data. Assuming that the library supports seek functionality, you can simply seek numberOfLine times lineLength to get to the first row of interest.
Library not at hand at the moment and I do not know if fixed width suites your current project.
jremington,
How do I ignoring the rows that are not to be included in the calculation?
In MATLAB I can easily code like this [y = H(V:end,2:end);]; where [(row,column)].
If there's a way for me to do it like that, please show me.
sterretje,
yes, I think of it too. How can I handle the library or maybe create a new one?
Btw, thank you jremington...sterretje...
for replying to my question. 