I am now involved in a relatively complicated Data Analysis exercise.
I have a series of frames (vehicle data: trajectory) and I need to extract from them given informations.
For that, I put the info of each frame in a struct.
And I want to store the structs into a first vector grouped based on 1 info: time (ps: all the structs/frames of this vector have the same time).
This vector will be a part of another struct frame_time.
and this mother struct will be stored in itself based on increasing time (another attribute of the frame).
After that, I can sort the frames in the minor vector (location) based on the location info:
I created the following code (this is only part of the program):
Expand|Select|Wrap|Line Numbers
- FrameTimeData frame_time_data;
- for (int i = 0; i<NumberOfFrames; i++)
- {
- VehFrameData veh_frame_data;
- veh_frame_data = FrameLocationInitial[i]; //vector of frames already arranged
- //based on time and sorted accordingly: just need to read them and then
- //classify them in different mother structs stored themselves in a vector
- frame_time_data.FrameLocation.push_back(veh_frame_data);
- if (FrameLocationInitial[i].time != FrameLocationInitial[i+1].time)
- {
- FrameTime.push_back(frame_time_data);
- FrameTimeData frame_time_data;
- }
- }
Regards