我曾嘗試在幫助指南中查找此內容,但看起來我正確地應用了它,但似乎沒有用。有人可以檢查我是否缺少什麼嗎?
我有一列是從另一列創建的,並四捨五入了值。我只需要根據新列中的值保留一定範圍的行。我只想保留介於50000和50999之間的New Y值,並刪除其餘的行。
這是我的腳本中具有此命令的部分,但不起作用。您可以在我正在處理的當前行之前看到已註釋掉的行,但是現在可能需要保留50000範圍內的其他值。
如果需要,我還附上了我的整個腳本作為參考。
dt = Current Data Table();
Column( dt, "X coordinate" ) << data type( Numeric ) << Modeling Type( Continuous ) << Format( Best, 12 );
dt << New Column( "New Y", Numeric, Nominal, Width( 5 ), Formula( Round( Y coordinate ) ) );
//dt << select where( :New Y != 50503 );
dt << select where( :New Y < 50000 & :New Y > 50999 );
dt << delete rows;
dt << New Column( "Normalized", Numeric, Continuous, Width( 10 ), Precision( 7 ), Formula( IntenCD / Col Max( IntenCD ) ) );
在此先感謝您的任何幫助。
Clear Symbols();
Names Default To Here( 1 );
framex_value = "";
lotid_value = "";
w = New Window( "Requested Information", // opens a window with a title and this content...
<<RETURN result=""> 50999 );
dt << delete rows;
dt << New Column( "Normalized", Numeric, Continuous, Width( 10 ), Precision( 7 ), Formula( IntenCD / Col Max( IntenCD ) ) );
// Determine Matrix
xMat = Matrix( 76200 - (framex_value / 2) ) |/ Matrix( 76200 - (framex_value / 2) ) |/ Matrix( 76200 + (framex_value / 2) ) |/
Matrix( 76200 + (framex_value / 2) );
// The yMat is static
yMat = [1, 0.92, 0.92, 1];
// The overall delta
overallDelta = Col Max( dt:Normalized ) - Col Min( dt:Normalized );
//The delta between the lines
withinOrangeDelta = Col Max(
If( dt:X coordinate > (76200 - (framex_value / 2)) & dt:X coordinate < (76200 + (framex_value / 2)),
dt:Normalized,
.
)
) - Col Max( dt:Normalized ) - Col Min( dt:Normalized ) + 1;
Col Min( If( dt:X coordinate > (76200 - (framex_value / 2)) & dt:X coordinate < (76200 + (framex_value / 2)), dt:Normalized, . ) );
// Graph Builer and Delta display
gb = dt << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( dt:X Coordinate ), Y( dt:Normalized ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
Report( gb )[FrameBox( 1 )] << Add Graphics Script(
Pen Color( "orange" );
Pen Size( 2 );
Line( xmat, ymat );
// Add the results to the chart
Text( Boxed, {75000, .94}, "Overall Delta = " || Char( Format( overallDelta, 7, 4 ) ) );
Text( Boxed, {75000, .93}, "Within Frame Delta = " || Char( Format( withinOrangeDelta, 7, 4 ) ) );
);
Report( gb )[AxisBox( 2 )] << Min( .91 );
Report( gb )<<SAVE picture=""></SAVE></RETURN>
我認為這只是一個邏輯問題。
您的select where語句:
dt << select where( :New Y < 50000 & :New Y > 50999 );
永遠不能成立,因為:新Y不能小於50000 和同時大於50999。
相反,您想要:
dt << select where( 50000 <= :New Y <= 50999 );
哦,謝謝。確實有道理。我用新行替換了代碼,但實際上並沒有刪除所有其他需要刪除的行,因此我只繪製了50000至50999之間的New Y值。我還能缺少什麼?
嗨,我仍然無法弄清楚如何刪除除特定範圍的Y坐標之外的所有坐標。借助先前幫助的更新,這是我正在處理的部分的新腳本。因此,我只需要保留從50000到50999的Y值,然後刪除其餘的值。
dt = Current Data Table();
Column( dt, "X coordinate" ) << data type( Numeric ) << Modeling Type( Continuous ) << Format( Best, 12 );
dt << New Column( "New Y", Numeric, Continuous, Width( 10 ), Formula( Round( Y coordinate, 0 ) ) );
//dt << select where( :New Y != 50503 );
dt << select where( 50000 <= :New Y <= 50999 );
dt << delete rows;
dt << New Column( "Normalized",
Numeric,
Continuous,
Width( 10 ),
Precision( 7 ),
Formula( IntenCD / Col Max( IntenCD ) )
);