如何在表變量內部引用表變量創建前兩個變量後,我想讓我的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);