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


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <vector>
#include <iostream>


using std::vector;
using namespace std;

#define HEIGHT 5
#define WIDTH 3
#define DEPTH 7

int main() {
  vector<vector<vector<double> > > 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.