JSL - 如何迭代双变量并将所有样条线保存到 1 列你好。我创建了一个字符串数组,其中包含在我的一列中找到的各种值。 我想为字符串数组中的每个值生成一个样条曲线,并将所有预测点保存到新列中。我能够迭代 Bivariate(),将每次迭代的 where 子句更改为字符串数组中的新值,但是,只有最后的预测点会保存到新列中。如何将所有预测点保存到新列中?谢谢。
Proc = "new";
processArray = {};
DataCV=open("C:\Desktop\JMP\sample_data.csv");
for (l = 1, l < 32521, l++, // Generate array of strings
if (proc == (Row()=l; :process),
print("same process"),
Insert Into(processArray, (Row()=l; :process)); proc = (Row()=l; :process); Show(proc)
);
);
for (n = 1, n <= length(processArray), n++, // Generate and save multiple predicteds
biv = Bivariate(
Y( :c_mm_deembed_pf ),
X( :v_dut_volt ),
Where( :c_type == "Cdg" & :process == processArray[n] ),// :process == processArray[n] appears to be working, as 6 splines are generated
Fit Spline( 0.1, standardized, {save predicteds}) // {save predicteds} is not saving all 6 splines, only last spline
);
); 

回复:JSL - 如何迭代双变量并将所有样条线保存到 1 列尝试使用 By() 角色来获取同一列中的所有预测。 这样就不需要对列表进行迭代,生成的预测公式将自动应用条件语句来分隔副列的不同值。 主要区别在于所有绘图将共享同一个窗口。
DataCV = Open("C:\Desktop\JMP\sample_data.csv");
DataCV << biv = Bivariate(
Y(:c_mm_deembed_pf),
X(:v_dut_volt),
By(:process),
Where(:c_type == "Cdg"),
Fit Spline(0.1, Standardized, {Save Predicteds})
);回复:JSL - 如何迭代双变量并将所有样条线保存到 1 列@tx尼尔森,
哎呀。 我没有看到后来的帖子,而是使用 Eval Expr 而不是 Substitute 回答了之前的问题。
我无意重复回复。
抱歉,吉姆。
回复:JSL - 如何迭代双变量并将所有样条线保存到 1 列而且,我只是再次考虑了“预测”列的“预测”公式,并意识到您正在使用的过程将在处理时相互写入。我建议您在每次执行二元变量后重命名 Prediced 列,强制每次迭代最终创建一个新列。
回复:JSL - 如何迭代双变量并将所有样条线保存到 1 列这是脚本的带注释的修改版本。试试看。我相信它会与您的数据配合使用。我无法真正做好测试,但任何错误都应该很小
Names Default To Here( 1 );
Proc = "new";
processArray = {};
DataCV = Open( "C:\Desktop\JMP\sample_data.csv" );
// In the commented area is a reworked version of your code that I believe
// simplifies the syntax of what you were doing. Please review it and see
// what changes I made.
/*for (l = 1, l <= N Rows(DataCV) , l++, // Generate array of strings
if (proc == :process[l],
print("same process")
,
Insert Into(processArray, :process[l]);
proc = :process[l];
Show(proc)
);
);*/
// The summarize() function is a much faster way to get the values found for
// a spcific column or combination of columns
Summarize( DataCV, processArray = By( :process ) );
For( n = 1, n <= Length( processArray ), n++, // Generate and save multiple predicteds
// I found that using a JSL variable in the where clause was having issues, because the formula
// created for the Predicted values contains a reference to PredictedArray, which JSL Variable can change,
// which makes the formula invalid. So what needs to be done, is to subsitute the actual value for
// predictedArray[n] into the Where Clause
Eval(
Substitute(
Expr(
biv = Bivariate(
Y( :c_mm_deembed_pf ),
X( :v_dut_volt ),
Where( :c_type == "Cdg" & :process == __process__ ), // :process == processArray[n] appears to be working, as 6 splines are generated
Fit Spline( 0.1, standardized, {save predicteds} ) // {save predicteds} is not saving all 6 splines, only last spline
)
),
Expr( __process__ ), processArray[n]
)
)
);