無法對錶公式使用 jmp 腳本執行布林邏輯你好,
我正在嘗試運行一個簡單的腳本,該腳本將選擇、然後隱藏和排除距中心徑向距離大於 100 毫米的點。
為了簡化偵錯,我將其分為兩個腳本:第一個腳本產生一列,其徑向距離為Radial = (x^2 + y^2)^(1/2) 公式,第二個腳本計算該公式,選擇並隱藏行其中徑向 > 100。
不幸的是這不起作用。由於一些非常奇怪的原因,評估僅適用於該公式達到一定值。徑向 >(超過 30 的任何值)選擇所有行。
我可以看到兩種解決方案:
1) 將值寫入徑向列,而不是公式本身。 (數值被正確評估,公式則不然)。不知道該怎麼做。
2) 理解並修正問題,以便可以根據大於 30 的值來評估公式。
腳本答案或互動式解釋都是可以接受的。想解決這個問題並從中學習。
謝謝!
戴夫
// script for creating the Radial column<BR />dt1 = Current Data Table ();
dt1 << New Column( "Radial", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));<BR /><BR />// script for evaluating the Radial formula<BR />dt =Current Data Table();<BR />dt << Clear Row States; <BR />dt << Select where(Radial < 100);<BR />dt << hide and exclude;<BR />
資料混合與清理回复:無法在表公式上使用 jmp 腳本執行布爾邏輯我在做一些猜測,但我相信 Radial 與 Radial 1 的問題是您沒有正確確定列變量的範圍。在你的聲明中
dt << Select where((Radial 1> 100) | (Radial 1< 30) | (Pits Only > mf));
您應該在列名稱前放置一個“:”:Radial 1 和:Pits Only。該腳本使用 Radial 1 的原因是沒有名為 Radial 1 的內存變量,JMP 可能會在其中混淆。我假設在您的編碼嘗試中的某個時刻,您不小心創建了一個 Radial 的內存變量,因此當您指定
dt << Select where((Radial> 100) | (Radial< 30) | (Pits Only > mf));
JMP 將 Radial 的值替換為內存變量值,而不是列 Radial 的值。
回复:無法在表公式上使用 jmp 腳本執行布爾邏輯感謝您回复傑夫。
將腳本的最後一行粘貼到我的腳本中並沒有解決問題。 但是,我能夠通過將列的名稱更改為“Radial 1”並在末尾添加一行 Eval Formula 來提供解決方案。 不知道為什麼會這樣。 數據表大約有1300行15列,每個數字的寬度為10到12。
以下兩個腳本有效。 我將它們全部粘貼。 其他線評估凹坑深度和分佈。
知道為什麼修改有效嗎? 我一天中的大部分時間都在做這件事。
腳本 1:創建“僅凹坑”和“徑向 1”列
dt1 = Current Data Table ();
dt1 << Clear Row States;
dt1 << New Column( "Pits Only", Formula (If( :Name( "Height (mm)" ) <= 0, :Name( "Height (mm)"), 0 )) );
dt1 << New Column( "Radial 1", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));
dt1 << Eval Formula;
obj = dt1 << Distribution( Column( :Pits Only), Horizontal Layout( 1 ), Count Axis);
腳本 2:隱藏和排除 Pits Only > 10 或 Radial 1 > 100 或 Radial 1 < 30 的行
dt =Current Data Table();
dt << Clear Row States;
win = New Window( "Feature Depth" , <<MODAL> 100) | (Radial 1< 30) | (Pits Only > mf));
dt << hide and exclude;</MODAL>
回复:無法在表公式上使用 jmp 腳本執行布爾邏輯恐怕我無法在這裡重現任何問題。 這是我用來測試的腳本。
dt1 = New Table( "Community 416651 Select Where",
Add Rows( 1000000 ),
New Column( "x coordinate",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Sequence( 5, 100, 5 ) ),
Set Selected
),
New Column( "y coordinate",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Sequence( 5, 100, 5, 20 ) ),
)
);
dt1 << New Column( "Radial",
Formula(
(X coordinate ^ 2 + Y coordinate ^ 2) ^ (1 / 2)
)
);
dt1 << Select where( Radial < 60 );
因此,我們需要更多關於您的腳本和數據表的詳細信息。
你的數據表有多大? 你的腳本還在做什麼?
回复:無法在表公式上使用 jmp 腳本執行布爾邏輯用於創建徑向列的腳本
dt1 = Current Data Table ();
dt1 << Clear Row States;
dt1 << New Column( "Radial", Formula ((X coordinate^2 + Y coordinate^2)^(1/2)));
用於評估徑向公式的腳本
dt =Current Data Table();
dt << Clear Row States;
dt << Select where(Radial < 100);
dt << hide and exclude;