双变量刻画器记住的设置动态项值变量大家好,
我真的很感激一些有关脚本的帮助。
我正在编写一个双变量拟合脚本,该脚本从列对话框中获取两列。我想加载一个已加载一些记住的设置的分析器。我遇到的问题是,我找不到在分析器的项值中引用/替换列名的正确方法。在下面的示例代码中,我保留了对列的硬编码引用,并且脚本可以运行,但我需要脚本能够灵活地使用不同的列名。我发现一个用户也有类似的问题,但我一直无法将对他们有效的解决方案应用到我的示例中,请参阅分析器:在项值脚本中使用变量不起作用。到目前为止,我编写表达式和替换项的经验仅限于公式列,所以这个问题对我来说有点难以解决。
任何能帮助纠正这个问题的帮助都将不胜感激。
亲切的问候,
卡塔尔
New Table( "Example",
Add Rows( 10 ),
New Column( "X",
Numeric,
"Continuous",
Format( "Best", 15 ),
Set Values( [20, 40, 60, 80, 100, 120, 140, 160, 180, 200] )
),
New Column( "Y",
Numeric,
"Continuous",
Format( "Best", 15 ),
Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] )
)
);
// Open dialog to select columns
dlg = Column Dialog(
colX = Col List( "X",
Min Col( 1 ),
Max Col( 1 ),
),
colY = Col List( "Y",
Min Col( 1 ),
Max Col( 1 ),
),
);
// Store list of selected columns
Eval List( Remove( dlg, -1 ) );
// Launch platform: Bivariate
report = Bivariate(
Y( colY[1] ) ,
X( colX[1] ),
Fit Polynomial( 1,
{Profiler(
1,
Confidence Intervals( 1 ),
Term Value( "X"n( 30, Lock( 0 ), Show( 1 ) ) ), // Need to replace with dynamic reference
Remember Settings( "1-Month", Differences Report( 0 ) ),
Term Value( "X"n( 60, Lock( 0 ), Show( 1 ) ) ), // Need to replace with dynamic reference
Remember Settings( "2-Months" ),
Term Value( "X"n( 90, Lock( 0 ), Show( 1 ) ) ), // Need to replace with dynamic reference
Remember Settings( "3-Months", Differences Report( 1 ) ),
Term Value( "X"n( 90, Lock( 0 ), Show( 1 ) ) ) // Need to replace with dynamic reference
)}
)
);
自动化和脚本回复:双变量分析器记住的设置动态项值变量我认为这样的事情可能会有用
Names Default To Here(1);
dt = New Table("Example",
Add Rows(10),
New Column("X",
Numeric,
"Continuous",
Format("Best", 15),
Set Values([20, 40, 60, 80, 100, 120, 140, 160, 180, 200])
),
New Column("Y",
Numeric,
"Continuous",
Format("Best", 15),
Set Values([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
)
);
dlg = Column Dialog(
colX = Col List("X", Min Col(1), Max Col(1), ),
colY = Col List("Y", Min Col(1), Max Col(1), ),
);
Eval List(Remove(dlg, -1));
report = Eval(Substitute(
Expr(dt << Bivariate(
Y(colY[1]),
X(colX[1]),
Fit Polynomial(
1,
{Profiler(
1,
Confidence Intervals(1),
Term Value(_x_(30, Lock(0), Show(1))),
Remember Settings("1-Month", Differences Report(0)),
Term Value(_x_(60, Lock(0), Show(1))),
Remember Settings("2-Months"),
Term Value(_x_(90, Lock(0), Show(1))),
Remember Settings("3-Months", Differences Report(1)),
Term Value(_x_(90, Lock(0), Show(1)))
)}
)
)),
Expr(_x_), Name Expr(AsColumn(dt, colX[1]));
));
回复:双变量分析器记住的设置动态项值变量完美!谢谢Jarmo!