I have the following 3D array:
x = randn(31,6,1000);
What I would like to do is to keep only those n repetitions that meet the following conditions:
- the rows from 1 to 12 for the first observation must be positive;
- the rows from 1 to 12 for the second observation must be positive;
- the rows from 1 to 12 for the sixth observation must be positive;
In coding terms:
% keep only the n repetitions out of 1000 that meet: % 1. x(1:12, 1, :) > 0; % 2. x(1:12, 2, :) > 0; % 3. x(1:12, 6, :) > 0;
Can anyone help me?
PS: The dataset is not representative of the original one, it was made just to see how a code would work.