匹配对脚本的用户输入我想为匹配对创建一个 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 );