[Scilab-users] Converting UT to Standard Time

Florian Winter flotschos at gmail.com
Thu Dec 10 11:22:11 CET 2015


Thank you very much!
I like this idea because the range is indeed small compared to the starting
time, I think I will use this approach!

Regards
Florian

2015-12-09 20:28 GMT+01:00 Samuel Gougeon <sgougeon at free.fr>:

> Hi,
> In that case, since the time range is small compared to the starting time,
> i would use simply
>
> plot(time-63600, values)
> xlabel("17:40:00 + [s]")
>
> Regards
> Samuel Gougeon
>
>
> Le 09/12/2015 18:37, Florian Winter a écrit :
>
> Hi,
> I have a problem. I get data about the time from a file in UT. That means
> I get the number of seconds elapsed on the day instead of a "normal" time
> (e.g. 63602 actually means 17:40:02)
>
> I'm trying to plot some values with this time but to make it more readable
> I would like to use "17:40:02" for the ticks on the x-axis instead of the
> seconds,
> so I wrote a function to convert the seconds to a string.
>
> If I don't change the ticks to the custom strings it automatically only
> shows 7 ticks but if I change it like I did, it shows the ticks for every
> single value I use and the whole thing becomes sort of unreadable.
> Is there a possibility to convert the time differently or can I somehow
> limit the number of ticks that should be drawn?
>
>
>
> ///////////////////////////////////////////////////////////////////////
> time = [63602,63602.05,63603,63603.5,63604,63606]
> values = [1,2,3,4,5,7]
>
> function convertedtime = timestring(UT) //converts UT
>     h=int(UT/3600);
>     UT=UT-h*3600;
>     m=int(UT/60);
>     UT=UT-m*60;
>     if UT < 10 then
>         convertedtime = string(h) + ":" + string(m) + ":0" + string(UT);
>     else
>         convertedtime = string(h) + ":" + string(m) + ":" +string(UT);
>     end
> endfunction
>
> newtime = timestring(time);
>
> plot(time,values);
> a=gca();
> ticks = a.x_ticks
> ticks.labels=newtime
> ticks.locations=time
> a.x_ticks=ticks
>
> ////////////////////////////////////////////////////////////
>
>
>
> Regards,
> Flotschos
>
>
> _______________________________________________
> users mailing listusers at lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20151210/ad1724c1/attachment.htm>


More information about the users mailing list