I am writing a for-loop script to search for the x-values of the y-maximum peaks in some parts of the spectra collected in different experimental conditions. However, the Data Filter stopped after running one round by the warning "Your selection was changed in another window." How can I get rid of this warning so that the script can be run smoothly to complete the for-loop?
Let me use Big Class.jmp example to demonstrate the problem. The objective is to show the subset of data corresponding to the people having the maximum weight (y-maximum value) in several ranges of heights (x-value ranges, say 55-60, 60-62, 62-65) by different ages (similar to experimental conditions).
The x-value ranges are grouped by two lists, one containing the lower limits & another one the upper limits. The maximum is found by Col Maximum with Data Filter. The calculation is looped for several x-value ranges along the lists. However, after running for i=1, the loop stops and the Data Filter warning appears. How to get rid of it to let the script complete the for-loop?
Names Default To Here( 1 );
ListA = {55, 60, 62};
ListB = {60, 62, 65};
for(i=1, i<=3, i++,
dt = Data Table( "Big Class" );
Current Data Table (dt);
a = ListA[i];
b = ListB[i];
dt << Data Filter(Add Filter(columns(:height), where(:height > a & :height < b)), Mode( Select( 0 ), Show( 0 ), Include( 1 )), Show Window(0), Auto Clear(1));
dt << select where (col maximum(:weight, :age, Excluded()) == :weight & :height > a & :height < b);
dt << subset(selected rows(1), columns({"name", "age", "sex", "height", "weight"}));
dt << Clear Row States;
dt << Clear Select();
);