如何在表变量内部引用表变量创建前两个变量后,我想让我的angleRefY 和angleRefX 变量从zeroX 和zeroY 偏移一个静态数。 我尝试了几种不同的方法来做到这一点,如下所示。

产生数字的唯一方法是这个脚本,但是变量变成了 6 而不是 QQ+1,所以它们仍然没有链接。
dt << Set Table Variable("TT", dt:QQ + 1);有谁知道如何做到这一点? 理想情况下,zeroX = 某个数字,zeroY = 某个数字,angleRefX = ZeroX + 某个数字,angleRefY = ZeroY + 某个数字作为动态参考。
回复:如何在表变量内引用表变量您始终可以将变量放入全局名称空间并引用它。
回复:如何在表变量内引用表变量好吧,就这样吧。 如果它只能存储字符串值,那么很明显我将无法将其作为动态引用。 运行表脚本是有意义的。 这也只是额外的一次点击,不错。 感谢您的帮助!!回复:如何在表变量内引用表变量吉姆,
感谢您关于表变量是字符的提示。 这是一个明确的问题,如果你不知道,那就拔掉你的头发。
另一点补充。如果,dt:QQ=“51”;然后包装 dt:QQ,像这样,num(dt:QQ) 将返回 51 而不是“51”。 但如果 dt:QQ 不是数字,那么它将返回缺失。
另一种可行的方法是,
if ( dt:TT == "51", show("success"), show("didn't quite work"));
是这样的,如果 dt:TT 是数字,它将起作用
if ( num( dt:TT ) == 51, show("success"), show("didn't quite work"));回复:如何在表变量内引用表变量表变量只是保存的字符串。即使您的 QQ 值有效,您的 IF 语句也永远不会为真。
if ( dt:TT == 51, show("success"), show("didn't quite work"));
dt:TT 的值永远不会是 51。所有表变量最终都作为字符串,因此 IF 语句要起作用,它必须写成:
if ( dt:TT == "51", show("success"), show("didn't quite work"));
这是脚本指南中的文档
Table Variables
Table variables are for storing a single text string value, such as “Notes”. To understand how
variables work, first get its existing value by sending a Get Table Variable message:
dt = Open( "$SAMPLE_DATA/Solubility.jmp" );
dt << Get Table Variable( "Notes" );
"Chemical compounds were measured for solubility in different solvents. This
table shows the log of the partition coefficient (logP) of 72 organic
solutes in 6 aqueous/nonpolar systems."
Now change the existing value of the string using Set Table Variable and then use Get
Table Variable again to check that the string has been updated:
dt << Set Table Variable( "Notes", "Solubility of chemical compounds" );
dt << Get Table Variable( "Notes" );
"Solubility of chemical compounds"
The following example adds two new table variables to a data table:
dt = Open( "$DOCUMENTS/Big Class.jmp" );
myvar = "This is my version of the JMP Big Class sample data.";
dt << Set Table Variable( "key1", myvar );
dt << Set Table Variable( "key2", myvar );
Notice that setting the value creates a new variable only if one by the given name does not
already exist. If you add two table variables with the same name, only one variable is created.
您可以使用表脚本执行您想要的操作,但您必须首先设置表变量 QQ,然后运行将更新 TT 的表脚本
回复:如何在表变量内引用表变量这会产生静态偏移,我应该更清楚目标是动态偏移。 例如,如果 QQ 被重新分配为 43,则目标是让 TT 自行解析为 44。
这是对您的代码的改编,它应该打印变量是否实际上是动态的。
names default to here(1);
dt=new table("Example", add rows(3),new column("Sample", values([1,2,3])));
dt << new table variable("QQ", 42 );
dt << New Table Variable("TT", eval(num(:QQ) + 1));
wait(0);
dt << set table variable("QQ", 50);
if ( dt:TT == 51, show("success"), show("didn't quite work"));回复:如何在表变量内引用表变量这是一个简单的例子。您的代码很接近,只需要了解所有表变量都是字符,而且,引用表变量所需要做的就是使用 :QQ ,因为 dt 已经是消息的对象。
names default to here(1);
dt=new table("Example", add rows(3),new column("Sample", values([1,2,3])));
dt << new table variable("QQ", 42 );
dt << New Table Variable("TT", num(:QQ) + 1);