回复:不接受格式化 (col << Format( "Fixed Dec", 10, 2 )) 並且仍然得到 3 個小數點作為輸出。 我究竟做錯了什麼?嗨阿齊扎,
我猜格式化不會改變基礎值,而只是改變值在數據表中的顯示方式。 因為在數據表中,您的示例實際上顯示為 0.01。
如果您想訪問代碼中較少的小數位,您可能應該四捨五入您的值。
希望這可以幫助。
回复:不接受格式化 (col << Format( "Fixed Dec", 10, 2 )) 並且仍然得到 3 個小數點作為輸出。 我究竟做錯了什麼?嗨,安雅,
謝謝您的意見。
我試過這個解決方案。 它或多或少起作用。 現在發生的是這個
round(0.1964565, 2)
/*:
0.2
回复:不接受格式化 (col << Format( "Fixed Dec", 10, 2 )) 並且仍然得到 3 個小數點作為輸出。 我究竟做錯了什麼?即使您更改表中的格式,值也不會更改。 您可以在獲取值後對其進行舍入,或者您可以使用 << Get Values with Format
Names Default To Here(1);
dt = Open( "$SAMPLE_DATA/Antibiotic MICs.jmp" );
row_nr = 3;
formatted_values = Column(dt, "neomycin") << Get Values(
Format( "Fixed Dec", 10, 2 ) /* a numeric column will be list of character items if a format is supplied, see format function */
);
row_val = formatted_values[row_nr];
請注意,這將返回一個字符串而不是數字( https://www.jmp.com/support/help/en/17.0/#page/jmp/date-and-time-functions.shtml?os=win&source=application#ww6742865 ). 您可以使用 Num() 將其轉換為數字
不接受格式化 (col << Format( "Fixed Dec", 10, 2 )) 並且仍然得到 3 個小數點作為輸出。 我究竟做錯了什麼?親愛的社區,您好,我將兩位小數點格式分配給一列,但是當我提取該值時,它仍然顯示 3 個小數點。 我會申請你的意見。 這是一個例子:
// Open Data Table: Antibiotic MICs.jmp
// → Data Table( "Antibiotic MICs" )
Open( "$SAMPLE_DATA/Antibiotic MICs.jmp" );
// Standardize column attributes-The main idea is the format= Fixed Dec, 10, 2-show two decimal points
Local( {old dt = Current Data Table()},
Current Data Table( Data Table( "Antibiotic MICs" ) );
For Each( {col, index}, {:streptomycin, :neomycin},
col << Format( "Fixed Dec", 10, 2 )
);
Current Data Table( old dt );
);
rowNum = 3;
colAntib = Column( Data Table( "Antibiotic MICs" ), "neomycin");
//colAntib << Format( "Fixed Dec", 10, 2 );-this also is not working
colAntibVal = colAntib[ rowNum ]; //it is showing 0.007, three decimal points自動化和腳本數據訪問