更快速地讀/寫單元格你好
我有一個大數據文件(250k行乘2k列),其中包含來自電子集成電路器件(IC)的生產數據。
我有一個jsl腳本,我用它來評估結果並查找數據中的模式,但是在這麼大的數據表中,完成運行需要幾個小時。
讀/寫我正在使用的單元格 DT:MeasureX [行] 但該指令似乎沒有執行效率,所以我切換到列(dt,“MeasureX”)[intRow] 而且這個執行起來要快20%。
是否有技巧來改善執行時間?比如在腳本執行時停止表窗口刷新...
謝謝
Re:更快地讀/寫單元格 @oscarmforero ,
由於您的數據是數字。嘗試在矩陣上執行大部分操作會快得多。
dt = Current Data Table();
Mat = dt << Get As Matrix; // fetches all numeric data as a matrix
獲得矩陣後,可以根據邏輯條件使用loc()進行選擇。這是一個更詳細的例子:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Get as Matrix
Mat = dt << Get as Matrix; // Note Matrix will only be 3 columns
// Selecting data in data table
SR = dt << Select Where(:height <= 65) << Get Selected Rows;
dt[SR,"height"] = 65;
dt << Clear Select;
// Selecting data in matrix
SR1 = Loc(Mat[0,2] <= 65);
Mat[SR1,2] = 65;
Re:更快地讀/寫單元格嗨馬克
例如,我有下面的代碼(這是需要更長時間執行的代碼),我使用循環來讀取單元格並再次比較它們的規格限制。如果單元格值超出限制,則讀取並覆蓋不同單元格的值。
numDataColumns = Current Data Table() << get column names( Numeric );
main_table = Current Data Table();<BR />
//Loop all columns with parametric data
For( intCol = 1, intCol <= N Items( numDataColumns ), intCol++,
Spec_Lims = Column( numDataColumns[intCol] ) << Get Property( "Spec Limits" );
Spec_USL_num = Try( Spec_Lims["USL"], . );
Spec_LSL_num = Try( Spec_Lims["LSL"], . );
USL_exist = Is Missing( Spec_USL_num ) == 0;
LSL_exist = Is Missing( Spec_LSL_num ) == 0;
//Loop all the selected rows (fails) and count the number of parametric fails and executed tests.
For( intRow = 1, intRow <= N Rows( Data Table( main_table ) ), intRow++,
If( Selected( Row State( Data Table( main_table ), intRow ) ) > 0,
If( Is Missing( Column( main_table, numDataColumns[intCol] )[intRow] ) == 0, //Only check for cells with data
//If both spec limits are available
If(
(USL_exist == 1 & LSL_exist == 1) & (Column( main_table, numDataColumns[intCol] )[intRow] > Spec_USL_num |
Column( main_table, numDataColumns[intCol] )[intRow] < Spec_LSL_num),
Column( main_table, "parFailCount" )[intRow] = Column( main_table, "parFailCount" )[intRow] + 1;<BR /> //log names of failing tests
Column( main_table, "failListNames" )[intRow] = Column( main_table, "failListNames" )[intRow] || Char( numDataColumns[intCol] )
|| ",";
);
//Considered only as executed tests when any of the limits are available.
If( USL_exist == 1 | LSL_exist == 1,
Column( main_table, "parExecutedTests" )[intRow] = Column( main_table, "parExecutedTests" )[intRow] + 1
);
)
)
);
);Re:更快地讀/寫單元格有許多方法可以提高腳本的性能,但該方法取決於腳本中的操作。你能描述一下腳本的作用嗎?評估結果並查找數據中的模式 ?“