[Scilab-users] Converting UT to Standard Time

Samuel Gougeon sgougeon at free.fr
Wed Dec 9 20:28:17 CET 2015


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 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/20151209/05ca9419/attachment.htm>


More information about the users mailing list