<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi:<br>First of all i want to ask you if time = [63602,63602.05,63603,63603.5,63604,63606] is correct. As you may notice, the first two values are too near... so in the plot the tics appear overlapped... if you use time = [63602,63602.5,63603,63603.5,63604,63606] the plot's tics become clearer...<br><br>The second question is how near this tics are supposed to be in the worst case? for example, if your time conssists of values sepparated about 0.05, you could create a new vector containing the positions of the tics, that exclude too near values... I mean:<br><br>time = [63602,63602.05,63602.09,63603.5,63604,63606]<br>values = [1,2,3,4,5,7]<br><br>function convertedtime = timestring(UT) //converts UT<br>    h=int(UT/3600);<br>    UT=UT-h*3600;<br>    m=int(UT/60);<br>    UT=UT-m*60;<br>    if UT < 10 then<br>        convertedtime = string(h) + ":" + string(m) + ":0" + string(UT);<br>    else<br>        convertedtime = string(h) + ":" + string(m) + ":" +string(UT);<br>    end<br>endfunction<br><br>    timeTics=time(1)<br>    for i=1:length(time)<br>        if(abs(timeTics($)-time(i))>=0.5)<br>            timeTics=[timeTics;time(i)]<br>        end<br>    end<br><br>newtime = timestring(timeTics);<br>plot(time,values);<br>a=gca();<br>ticks = a.x_ticks<br>ticks.labels=newtime<br>ticks.locations=timeTics<br>a.x_ticks=ticks<br><br>This may be non optimall solution, but may work<br><br><br><br><div><hr id="stopSpelling">Date: Wed, 9 Dec 2015 18:37:37 +0100<br>From: flotschos@gmail.com<br>To: users@lists.scilab.org<br>Subject: [Scilab-users] Converting UT to Standard Time<br><br><div dir="ltr">Hi,<div>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)</div><div><br></div><div>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,</div><div>so I wrote a function to convert the seconds to a string.</div><div><br></div><div>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.</div><div>Is there a possibility to convert the time differently or can I somehow limit the number of ticks that should be drawn?</div><div><br></div><div><br></div><div><br><div>///////////////////////////////////////////////////////////////////////</div><div><div>time = [63602,63602.05,63603,63603.5,63604,63606]</div><div>values = [1,2,3,4,5,7]</div><div><br></div><div>function convertedtime = timestring(UT) //converts UT</div><div>    h=int(UT/3600);</div><div>    UT=UT-h*3600;</div><div>    m=int(UT/60);</div><div>    UT=UT-m*60;</div><div>    if UT < 10 then</div><div>        convertedtime = string(h) + ":" + string(m) + ":0" + string(UT);</div><div>    else</div><div>        convertedtime = string(h) + ":" + string(m) + ":" +string(UT);</div><div>    end</div><div>endfunction</div><div><br></div><div>newtime = timestring(time);</div><div><br></div><div>plot(time,values);</div><div>a=gca();</div><div>ticks = a.x_ticks</div><div>ticks.labels=newtime</div><div>ticks.locations=time</div><div>a.x_ticks=ticks</div></div><div><br></div><div>////////////////////////////////////////////////////////////</div></div><div><br></div><div><br></div><div><br></div><div>Regards,</div><div>Flotschos</div></div>
<br>_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users</div>                                        </div></body>
</html>