这篇文章末尾的脚本基本上完成了我想要它做的事情(即,查找 Y 值为 100 且时间 = 0 的列),但它也会生成一条让我有点不舒服的日志消息(已经进入陷阱之前):
A message with an empty Boolean argument enabled an option that was already enabled. That option remains enabled. In previous versions of JMP, this would have disabled the option.
在作为循环构造的一部分已经选择了一次之后,此消息将针对再次选择的每一列打印到日志中。 作为一个对脚本比较陌生的人,我必须主要关注:
- 这个日志消息是我绝对应该避免的吗?我会遇到麻烦吗? 我最终将处理更大的表,因此对于单个脚本执行,可能会打印数百次此日志消息。
- 有没有更聪明的方法来查找表中对于时间 = 0 的每一行的 Y 值 = 100 的所有列? (在我的例子中,我将处理具有许多列的表,其中一些包含在时间 =0 时归一化为 100% rel. 的结果。 这些是我感兴趣的专栏。)
Names Default To Here( 1 );
// table required for example
dt = New Table( "Results (absolute & relative) vs time",
Add Rows( 8 ),
New Column( "time",
Numeric,
Set Values( [0, 1, 2, 3, 0, 1, 2, 3] ),
),
New Column( "Y1_absolute",
Numeric,
Set Values( [7, 8, 1, 9, 0.2, 0.4, 0.65, 0.98] ),
),
New Column( "Y1-relative",
Numeric,
Set Values( [100, 114, 14, 129, 100, 200, 325, 490] ),
),
New Column( "Y2_absolute",
Numeric,
Set Values( [12, 6, 4, 0, 80, 90, 120, 75] ),
),
New Column( "Y2_relative",
Numeric,
Set Values( [100, 50, 33, 0, 100, 113, 150, 94] ),
)
);
// selecting columns where for :time == 0 a Y-value == 100 is found
For( i = 1, i <= N Row( dt ), i++,
For( j = 1, j <= N Col( dt ), j++,
If( Column( j )[i] == 0,
For( k = 1, k <= N Col( dt ), k++,
If( Column( k )[i] == 100,
Column( k ) << Set Selected
)
)
)
)
);