Hi,
I have some JSL code that takes a long time to execute for larger datasets.
The code runs a for loop within a for loop to calculate the mean offset by strips. I’m looking for a faster way of doing this.
Is there a way to make the processing faster? The current script takes ~20 mins to complete the loop
Here's the script below:
Names Default To Here( 1 );
dt1 =Data table( "Reference data table.jmp" );
dt2 = Current data table(); /// Select Data table.jmp
Col_List1 = dt2 << Get Column Names( "String" );
For( c = 1, c <= N Col( dt2 ) -1, c++,
theMatrix = [];
name = Column( Col_List1[c] ) << Get name;
if (Contains( Col_List1[c], "Currents" )| Contains( Col_List1[c], "Voltage" )| Contains( Col_List1[c], "Resistance" ),
For( r = 1, r <= N Rows( dt2 ), r++,
mean = dt1:Mean[dt1 << Get Rows Where( :Tests == name )];
measure = mean - Col Mean( If( dt2:Strips == dt2:Strips[r], Column( dt2, c ), . ) );
theMatrix = theMatrix || Column( dt2, c )[r] + measure;
);
Column( dt2, c ) << Set Values( theMatrix );
););