我在金融市场工作了几年,有时我需要特别处理一个值的小数部分。当我获得作为string的值时,我使用Regex,当我得到作为double或decimal的值时,我使用%、天花板和pow。
// with math operations to get a truncated int value from the decimal part
// of a decimal or double
(int)Math.Ceiling((value % 1) * Math.Pow(10D, (double)(decimalLength - 1)))
// with Regex to get a trunca
我尝试在datetime中使用day函数,如下所示
day(dateserial, 'dayofyear')
取而代之的是,金融包中的函数day被称为giving me day of month,因为有一个具有类似签名的day函数。
我在文档中找不到如何区分相同的函数名。我在互联网上发现建议我应该从路径中删除包,但这是荒谬的,因为这些是标准的MATLAB包。
示例:
day(now,'dayofyear')
Warning: Unless the first input argument is a date character vector, all subs