### Multi-dimension vectors

Ok I'm trying to create matrix of data that I can add values to based on a reading that I will get from a DVM. I'm using a 3d vector to do this. I need to keep track of the serial number, the day and within day I need to take two readings at different temps, this will continue for 7 days.

The rows of my 3d vector will be the days, the colums will be the serial numbers the depth will be the reading at the different temps.

What I need to do is compare the first element (days) and when it is greater then or equal to 4 I will perform calculations of the readings. So all I want to do is compare the first element of the vector, How do I do this?

Here is what I got

 ``123456789101112131415161718192021222324252627282930313233343536373839`` ``````#include #include using std::vector; using namespace std; #define HEIGHT 5 #define WIDTH 3 #define DEPTH 7 int main() { vector > > array3D; // Set up sizes. (HEIGHT x WIDTH) array3D.resize(HEIGHT); for (int i = 0; i < HEIGHT; ++i) { array3D[i].resize(WIDTH); for (int j = 0; j < WIDTH; ++j) array3D[i][j].resize(DEPTH); } // Put some values in // The second element will have 2 readings for each temp so the depth will be 2*5=10 but the last four only used for day 7 array3D[1][2][1] = 10; array3D[1][2][5] = 6.0; //this is for the 5k pots,.First element is the serial number, second element is the reading( this will be Pins 1-2, then pins 2-3 for each temp), element three is the day array3D[3][1][4] = 5.5; // this is for the 20k pots array3D[0][2][1] = -15.264; while( array3D[1][0][0] == 1) { cout << array3D[1][2][5] << endl; cout << array3D[0][2][1] << endl; } return 0; }``````
Topic archived. No new replies allowed.