adding vector
Oct 23, 2017 at 7:59am UTC
Hello can someone help me please.
I have three vector
V.lat;
V.lon;
and V.height;
1 2 3 4 5 6 7 8 9 10 11
v.lat
33.23944092
33.23962021
33.23980331
33.23996735
33.24013519
33.24029922
33.24045181
33.24060440
33.24074936
33.24088669
1 2 3 4 5 6 7 8 9 10 11
v.lon
135.19400024
135.21575928
135.23754883
135.25933838
135.28112793
135.30291748
135.32470703
135.34646606
135.36825562
135.39001465
1 2 3 4 5 6 7 8 9 10 11
v.h
101184.69
101186.76
101188.84
101190.92
101193.03
101195.17
101197.33
101199.52
101201.72
101203.91
i want to make new vector so it will be
1 2 3 4 5 6 7 8 9 10 11
33.23944092 135.19400024 101184.69
33.23962021 135.21575928 101186.76
33.23980331 135.23754883 101188.84
33.23996735 135.25933838 101190.92
33.24013519 135.28112793 101193.03
33.24029922 135.30291748 101195.17
33.24045181 135.32470703 101197.33
33.24060440 135.34646606 101199.52
33.24074936 135.36825562 101201.72
33.24088669 135.39001465 101203.91
please help i already try using
1 2 3 4 5 6
for (int i=0; i<V.size(); i++)
latlonh.reseve(V[i].lat +V[i].lon + V[i].h);
latlonh.insert(latlonh.end(), V[i].lat);
latlonh.insert(latlonh.end(), V[i].lon);
latlonh.insert(latlonh.end(), V[i].h);
but it just adding the data and make one column i need all the three column
please help
Oct 23, 2017 at 8:05am UTC
A vector is one-dimensional. You need more than one vector, or a vector of vectors, or a new structure that you design to hold the data.
Oct 23, 2017 at 8:21am UTC
So i must make like a multidimensional vector ?
Oct 23, 2017 at 8:25am UTC
You could do. I would create a struct for holding data about one point:
1 2 3 4 5 6
struct Point
{
double latitude;
double longitude;
double height;
}
so that each point has all its data together, and then create a single vector of these:
vector<Point> allPoints;
Oct 23, 2017 at 8:54am UTC
i see, and how about to save two columns ?
Oct 23, 2017 at 8:55am UTC
What does "save" mean?
Topic archived. No new replies allowed.