根据列规范限制更改列值我们有一个相位测试,有时喜欢将值翻转 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] ) )
)
);
);