[Scilab-users] comma format
Rafael Guera
jrafaelbguerra at hotmail.com
Sat May 16 15:08:56 CEST 2015
Fyi, a basic way to insert commas by handling the number as a string, in case
it helps:
x= -%pi*1e10;
sx= msprintf("%.4f",x); //define decimal accuracy needed
N=length(sx);
if N<4 then return;
end
ix = strindex(sx,'.');
if isempty(ix) then ix=N+1;
end
sy= part(sx,1);
for i=2:ix-4
sy = sy+part(sx,i);
if modulo(ix-1-i,3)==0 then sy = sy+','; // comma separator added
end
end
sy = sy+part(sx,ix-3:N); // No commas inserted after decimal point
printf("%s\n%s\n",sx,sy)
Regards,
Rafael
-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Samuel Gougeon
Sent: Saturday, May 16, 2015 11:16 AM
To: International users mailing list for Scilab.
Subject: Re: [Scilab-users] comma format
Le 16/05/2015 04:13, fujimoto2005 a écrit :
> Thanks a lot.
>
>> 'Depending on what are source numbers'
> Could you teach me more specific what kind of source numbers should I use
> ticks_format for and x_ticks?
I meant: is '32,025,145' the representation of only one number, ","
being the thousands separator ; or of several ones, or of only one with
check codes, etc??
But actually, even if "," is used as thousands separator, AFAIK C format
used in ticks_format does not propose option for it:
<http://help.scilab.org/docs/5.5.2/en_US/scanf_conversion.html>
http://help.scilab.org/docs/5.5.2/en_US/scanf_conversion.html
So, in every way, you will have to comput the 3 numbers 32, 25, 145 and
then the string '32,025,145' before assigning it as label through the
x_ticks axes property.
_______________________________________________
users mailing list
<mailto:users at lists.scilab.org> users at lists.scilab.org
<http://lists.scilab.org/mailman/listinfo/users>
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150516/f4b8a1af/attachment.htm>
More information about the users
mailing list