I have a n X 10 dataset (variable name = dataset, see attached file). Of interest are column 1 (variable name T) and column 6 (variable name E). What I want to do is this:
1) Compare column 6 values in each cell to a threshold variable (variable name thresh). Identify the cells which are greater than this threshold (i.e. E(:,1) > thresh)
2) For the rows which fulfill condition 1, note the corresponding value in column 1 and find all rows in the dataset which have exactly the same values in column 1 (these are typically a few before or after the row which fulfill condition 1).
3) Copy these rows from condition 2 and store them into new variable data_1.
I have tried this code:
T(:,1) = data(:,1);
E(:,1) = data(:,6);
thresh = 85;
for i = 1:A
if E(i,1)> thresh
row_size = max(size(row));
for j = 1
data_1(j:j+row_size-1,1:10) = data(min(row):max(row),1:10);
However the answers are wrong. The result in data_1 is a 5x10 variable with incorrect values. Can someone please advice what is going wrong?
Thank you. Regards Ben