根據列規範限制更改列值我們有一個相位測試,有時喜歡將值翻轉 360 度。 我想要一個可以查看表列數據、取平均值然後將其與 LSL/USL 進行比較的腳本。 如果平均值的符號與規格限制相反,則在該值上加上 360。
由於測試儀處理數據的方式,我不能一概而論 If( :test < 0, t1 = :column + 360; t1; )。
我附上了一個示例表,最後兩列是我的問題所在。
提前致謝
數據表腳本回复:根據列規範限制更改列值謝謝尼爾森先生。
我不得不稍微修改腳本。 我將乘法改為加法,並將均值改為中位數。 當我發布原始帖子時,我沒有考慮到災難性的失敗。 第 40 和 41 列的列均值不在 LSL 和 USL 之間。
Names Default To Here( 1 );
dt = Current Data Table();
colList = dt << get column names( continuous, string );
For( i = 1, i <= N Items( colList ), i++,
specs = Column( dt, colList[i] ) << get property( "spec limits" );
If( Is Missing( specs["LSL"] ) == 0 & Is Missing( specs["USL"] ) == 0,
If( !(specs["LSL"] <= Col Median( Column( dt, colList[i] ) ) <= specs["USL"]),
For Each Row( As Column( dt, colList[i] ) = 360 + As Column( dt, colList[i] ) )
)
);
);
回复:根據列規範限制更改列值看看這個小腳本是否能滿足您的需求
Names Default To Here( 1 );
dt = Current Data Table();
colList = dt << get column names( continuous, string );
For( i = 1, i <= N Items( colList ), i++,
specs = Column( dt, colList[i] ) << get property( "spec limits" );
If( Is Missing( specs["LSL"] ) == 0 & Is Missing( specs["USL"] ) == 0,
If( !(specs["LSL"] <= Col Mean( Column( dt, colList[i] ) ) <= specs["USL"]),
For Each Row( As Column( dt, colList[i] ) = -1 * As Column( dt, colList[i] ) )
)
);
);