开发者

How to get quotient in integer division in matlab?

I wonder how to get quotient in in开发者_C百科teger division in MATLAB? Thanks and regards!


Use idivide:

C = idivide(A, B) is the same as A./B except that fractional quotients are rounded toward zero to the nearest integers.

There's a third optional parameter for controlling the rounding behavior that's explained on the MathWorks site that I linked to.


Simply, put as following:

floor(A/B)

floor command rounds the value to the nearest integer, towards negative infinity (-inf).


just divide and round down?

or are you talking about integer division, in which case use idivide

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜