[Scilab-users] Digit Grouping in msprintf?

Rafael Guerra jrafaelbguerra at hotmail.com
Fri Nov 17 20:14:47 CET 2017


Corrected version:


// START OF CODE
n = 2725977;
p = int(log10(n)/3)*3;
x=[];
for i=p:-3:0;
    x = [x int(n/10^i)];
    n=modulo(n,10^i);
end
// END OF CODE



Regards,

Rafael



-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Richard llom
Sent: Friday, November 17, 2017 5:12 PM
To: users at lists.scilab.org<mailto:users at lists.scilab.org>
Subject: Re: [Scilab-users] Digit Grouping in msprintf?



Hi Samuel,

I need the number in "kWh", but no digits after the comma.



Postprocessing with strcat(s," ") is a nice idea.

Is there a function to split the number to the power of 10 factors?

Eg. 2725977 becomes

[2 , 725 , 977]



Then it would be really easy. :-)

Thanks

richard


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20171117/3f455e65/attachment.htm>


More information about the users mailing list