Hey guys, I’m designing an app that analyzes data from the accelerometer from the phone.
What I’m trying to do is display that data collected into a a tableview. The basic outline is that it sampling data every 0.2sec and should display the data into sections (each section is a second) with 5 rows (each row is the sampled data every 0.2sec)
What I am trying to display is that each section is labeled the appropriate second and in each section showing the accelerometer data (Z axis):
Each row is the accelerometer data collected a every 0.2sec (hence each section is 0.2sec * 5)
What I thought would work is take the data and store it into an array. I’m having trouble breaking up the data for display.
I then created a dictionary or arrays where each key is the “second” and the values are an array of the accelerometer data for that second. My thinking was that I could label each section based on the key and display the values for that key into the rows but I’m stuck and not sure if that was the right approach.
I tried storing the keys and values into arrays in my tableview controller using keys = acceldata.keys but can extract the values as individual elements of that array.
ex.
acceldata[1] : [0.2, 0.4, 0.6, 0.8, 1.0]
acceldata[2] : [-0.2, -0.4, -0.6, 0.8, -1.0]
How I would like for it to be displayed:
second 1
- 0.2
- 0.4
- 0.6
- 0.9
- 1.0
second 2
- -0.2
- -0.4
- -0.6
- -0.8
- -1.0
I am not sure if this logic was correct or if there is another way of doing this. Any advice would be helpful. Should I stick with the dictionary method? My hope was that I could use each key as the title for the section and value for that key as the data source for the rows.