Exractin 3D matrix from 4D

Hello everyone,
I will be very happy if you can help me. I have 4D matrix , which is called EC and like EX[p][a][b][c]. I want to extract 3D matrix of each p like New_EC=[a][b][c] for any p. I tried the following but did not work.

Thank you so much for any help in advance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  	vector<vector<vector<double>>>sum_temp;
	for (int j = 0; j < EC[p].size(); j++)
	{
		vector<vector<vector<double>>>sum_temp;
		for (int s = 0; s < EC[p][0].size(); s++)
		{
			vector<vector<double>>EC_2D;
			for (int ss = 0; ss < EC[p][s][0].size(); s++)
			{
				vector<int>ECvv;
				for (int ks = 0; ks < EC[p][s][0].size(); s++)
				{
					ECvv.push_back(EC[p][j][s][ss]);
				}
				EC_2D.push_back(ECvv);
			}
			
			
		}
		sum_temp.push_back(EC_2D);
	}
Doesn't
auto the_nth_3d_matrix = the_4d_matrix[n];
do what you want?
Last edited on
@mbozzi ,yes, exactly. That's what I want. You helped me :) Thank you so much
Topic archived. No new replies allowed.