CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Threaded View

  1. #1
    Join Date
    May 2011
    Posts
    6

    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


    Code:
    #include <vector>
    typedef std::vector<double> Double1D;
    typedef std::vector<Double1D> Double2D;
    typedef std::vector<Double2D> Double3D;
    
    #define HEIGHT 5
    #define WIDTH 3
    #define DEPTH 7
    
    int main() 
    {
       Double3D array3D(HEIGHT, Double2D(WIDTH, Double1D(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[3][1][4] = 5.5; // this is for the 20k pots
      
      return 0;
    }
    Last edited by hfbroady; April 23rd, 2012 at 03:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured