help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginners Question - diagram date / values


From: Kai Torben Ohlhus
Subject: Re: Beginners Question - diagram date / values
Date: Sat, 31 Mar 2018 22:02:09 +0000


On Sat, Mar 31, 2018 at 8:42 PM Martin Wagner <address@hidden> wrote:
Thanks, this works so far. But now X axis is in Days from the beginning
of the recording. How do I get the original times in X axis?

 
Please keep the help mailing list in the CC.  This way others may profit from our dialogue.  The following should bring you the original times to the X axis:

```
blub = ["Time,Temperature\n" ... 
"27.02.2018 17:10:56,19.99\n" ... 
"27.02.2018 17:11:57,19.91\n" ... 
"27.02.2018 17:12:58,20.01\n" ... 
"27.02.2018 17:13:59,19.98\n" ... 
"27.02.2018 17:15:00,20.15\n" ... 
"27.02.2018 17:16:01,20.20\n" ... 
"27.02.2018 17:17:02,20.14"]; 

a = textscan (blub, '%s %f', 'Delimiter', ',', 'HeaderLines', 1);
a{1} = datenum (a{1}, 'dd.mm.yyyy HH:MM:SS');
x = a{1};
y = a{2};
figure ();
plot (x - x(1), y)
set (gca (), "xticklabel", datestr(x,'dd.mm.yyyy HH:MM:SS'));
```

Unfortunately the datetick-Function [1] does not behave well here, because of the aforementioned bad scaling of the xtick data, therefore this ugly workaround seems necessary.

HTH,
Kai

[1] https://octave.org/doc/interpreter/XREFdatetick.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]