Sunday, December 16, 2012

Matlab does not print whole numbers!

Actually, it does, but it decides what is an "integer". For example:
sprintf('%i',dac_start(4))
This returned 3.317660e+004 even though I told Matlab to print with %i. The solution is to round the number, resulting:
sprintf('%i',round(dac_start(4)))
ans =
33177
Until I realized that my number 33176.6, I was going batty. round() solved the problem.

No comments:

Post a Comment