help-octave
[Top][All Lists]
Advanced

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

Re: SQLITE with Octave


From: Przemek Klosowski
Subject: Re: SQLITE with Octave
Date: Wed, 10 May 2017 17:13:33 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0

On 05/10/2017 04:44 PM, Przemek Klosowski wrote:
One conceptual problem I have is that it returns the data as an array of structs (one per row); e.g. for my simple temperature data,

a(1:2).time,a(1:2).tempc
ans = 2016-04-08 17:30
ans = 2016-04-08 17:45
ans = 35
ans = 36

What's the easiest way to return the entire column of data, i.e. collate a given struct field from every array member into a vector?

Never mind, it's of course a comma-separated list so the following works:

a=sqlite3("temp.db",'select julianday(time)as d,tempc as t from t')
plot([a.d],[a.t])

One word of caution: I had to rename the columns because the code silently fails for fancy SQL expressions such as julianday(time), probably because it's an invalid struct field name.


reply via email to

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