匹配對腳本的用戶輸入我想為匹配對創建一個 JMP 腳本,用戶可以在其中輸入匹配對的列,然後我可以獲得輸入的選定列。
所以像
dt=當前數據表();
匹配對();
Y,配對響應<<被選中;
然後我想使用在我自己的公式中選擇的列。 但我無法弄清楚如何選擇列。
回复:匹配對腳本的用戶輸入我把它作為一個兩步腳本來工作。 如果你找到它,請告訴我。 我想把這些結合起來,做成一個插件。
回复:匹配對腳本的用戶輸入通常腳本會提出一個模態對話框,要求用戶選擇要分析的列。 當用戶關閉對話框時,您卸載該對話框。 您現在擁有啟動平台並繼續進行其他計算的列。
最近有一個關於如何像您一樣使用啟動對話框但獲得對平台的引用並控制腳本其餘部分的評估的討論。 我暫時找不到它...
回复:匹配對腳本的用戶輸入我正在嘗試編寫一個運行匹配對平台的腳本,獲取它們放入匹配對的列,然後使用這些列進行額外的計算。
回复:匹配對腳本的用戶輸入我不明白你在做什麼。 我認為用戶在運行腳本之前已經打開了 Matched Pairs 平台,並且您需要發現 Y 角色中的數據列。 您的代碼(如下)將只打開 Matched Pairs 啟動對話框:
dt = current data table();
Matched Pairs();
所以不會有任何大綱框可供參考。
回复:匹配對腳本的用戶輸入我只是這樣做了:
dt=當前數據表();
配對();
// 找到 Matched Pairs 平台並為其獲取表達式
窗口 =獲取窗口列表();
為了( w = 1個, w <= N 項(窗口), w++,
標題=窗口[w] <<獲取窗口標題;
如果(包含( 標題, “配對” ),
obj = 窗口[w][輪廓框( 1個)] <<獲取腳本對象;
小號=對象<<獲取腳本;
休息();
);
);
// 隔離 Y() 命名參數
小號 =精氨酸(名稱表達式( 小號 ), 1個);
n 響應 =精氨酸(名稱表達式(小號));
// 獲取 Y 角色中的數據列
列參考 =列表();
為了( c = 1個, c <= n 響應, c++,
插入( col 參考,精氨酸(名稱表達式(s), c));
);
// 檢查結果,或使用腳本其餘部分中的列引用作為公式
展示(列參考);
這部分不起作用,我收到此錯誤:
在'window[w][Outline Box(1)]',window[w][/*###*/Outlinebox(1)]的訪問或求值中不能下標顯示框
在對選定的列進行計算之前,我試圖確保這部分工作正常。
回复:匹配對腳本的用戶輸入Names Default to Here( 1 );
// simulate actions by user before running the script
dt = Open( "$SAMPLE_DATA/Fitness.jmp" );
dt << Matched Pairs(
Y( :Runtime, :RunPulse, :RstPulse, :MaxPulse ),
Separate Pairs( 0 ),
Reference Frame( 0 )
);
// your script begins here
// find Matched Pairs platform and get expression for it
window = Get Window List();
For( w = 1, w <= N Items( window ), w++,
title = window[w] << Get Window Title;
If( Contains( title, "Matched Pair" ),
obj = window[w][OutlineBox(1)] << Get Scriptable Object;
s = obj << Get Script;
Break();
);
);
// isolate Y() named argument
s = Arg( Name Expr( s ), 1 );
n response = N Arg( Name Expr( s ) );
// get data columns in Y role
col ref = List();
For( c = 1, c <= n response, c++,
Insert Into( col ref, Arg( Name Expr( s ), c ) );
);
// examine results, or use the column references in the rest of the script for a formula
Show( col ref );
回复:匹配對腳本的用戶輸入如果我的理解是正確的,那麼如果他們輸入兩個 Y,這將起作用。 如果他們輸入兩個以上的 Y 怎麼辦,您可以將其作為列表或矩陣輸入嗎? 然後循環列表?
回复:匹配對腳本的用戶輸入我在發布解決方案後意識到,如果我的解釋是正確的,您將不會引用 Matched Pairs 對象。 你將不得不找到它。 這是腳本的更新版本。
Names Default to Here( 1 );
// simulate actions by user before running the script
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Matched Pairs( Y( :height, :weight ), Reference Frame( 1 ) );
// your script begins here
// find Matched Pairs platform and get expression for it
window = Get Window List();
For( w = 1, w <= N Items( window ), w++,
title = window[w] << Get Window Title;
If( Contains( title, "Matched Pair" ),
obj = window[w][OutlineBox(1)] << Get Scriptable Object;
s = obj << Get Script;
Break();
);
);
// get data columns in Y role
y1 = Arg( Arg( Name Expr( s ), 1 ), 1 );
y2 = Arg( Arg( Name Expr( s ), 1 ), 1 );
// examine results, or use the column references in the rest of the script for a formula
Show( y1, y2 );
回复:匹配對腳本的用戶輸入我將您的請求解釋為用戶已經啟動了 Matched Pairs 並且您想要針對它運行腳本。 也就是說,您的腳本不會要求用戶提供列或啟動平臺本身。
我找不到返回匹配對的 Y 角色中使用的數據列的消息。 我採用了一種方法,即獲取已啟動平台的腳本,然後對其進行解析以獲取數據列。
Names Default to Here( 1 );
// simulate actions by user before running the script
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
mp = dt << Matched Pairs( Y( :height, :weight ), Reference Frame( 1 ) );
// script begins here
s = mp << Get Script;
y1 = Arg( Arg( Name Expr( s ), 1 ), 1 );
y2 = Arg( Arg( Name Expr( s ), 1 ), 1 );
// examine results, or use the column references in the rest of the script for a formula
Show( y1, y2 );