回复:不接受格式化 (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自动化和脚本数据访问