<o:p> </o:p>
Hi Dave,<o:p></o:p>
<o:p> </o:p>
Sorry for the late reply. Can only reply after work.<o:p></o:p>
<o:p> </o:p>
>>> but the function k = kx(ip, p) still gives me this error<o:p></o:p>
<o:p> </o:p>
Yes, the class c is moved into the package kx, so thats why the function kx is not working anymore.<o:p></o:p>
<o:p> </o:p>
>>> fetch(k, ‘.z.p’) gives the following error<o:p></o:p>
<o:p> </o:p>
Yes, cause fetch is working on c instead of kx.c. What you need to do is to replace c with kx.c<o:p></o:p>
<o:p> </o:p>
m) kdb = kx.c(‘localhost’,8888)<o:p></o:p>
m) a = fetch(kdb,‘1’)<o:p></o:p>
m) edit fetch<o:p></o:p>
<o:p> </o:p>
This will open the editor to modify the fetch function.<o:p></o:p>
<o:p> </o:p>
Here is a code snippet:<o:p></o:p>
<o:p> </o:p>
kxtype = class(t);<o:p></o:p>
switch kxtype<o:p></o:p>
<o:p></o:p>
case ‘c$Dict’<o:p></o:p>
<o:p></o:p>
%Get c$Flip components<o:p></o:p>
tx = t.x;<o:p></o:p>
ty = t.y;<o:p></o:p>
tmp = kxout2struct(tx.x,tx.y);<o:p></o:p>
flds = fieldnames(tmp);<o:p></o:p>
for i = 1:length(flds)<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
As you can see the case is c$Dict instead of kx.c$Dict<o:p></o:p>
<o:p> </o:p>
I remembered I have modified somewhere the c.java class to work directly without the fetch function in matlab. I will send it to you once I have found it<o:p></o:p>
<o:p> </o:p>
HTH,<o:p></o:p>
<o:p> </o:p>
Kim<o:p></o:p>
<o:p> </o:p>
<o:p> </o:p>
<o:p> </o:p>
Von: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] Im Auftrag von dave
Gesendet: Montag, 23. Februar 2015 22:15
An: personal-kdbplus@googlegroups.com
Betreff: Re: [personal kdb+] kdb query in matlab r2013a<o:p></o:p>
<o:p> </o:p>
Hi Kim,
I am using Matlab 2014a and tried the latest version of jdbc.jar from http://kx.com/q/c/ but the function k = kx(ip, p) still gives me this error:<o:p></o:p>
"Undefined function ‘c’ for input arguments of type ‘char’.<o:p></o:p>
Error in kx (line 63)<o:p></o:p>
Error in KdbTest (line 10) k = kx(host, port);"<o:p></o:p>
When I tried what you suggested k = kx.c(host, port), the connection works and gives an answer of<o:p></o:p>
kx.c@3dcc874a<o:p></o:p>
But then doing fetch(k, ‘.z.p’) gives the following error:<o:p></o:p>
“Undefined function ‘fetch’ for input arguments of type ‘kx.c’.”<o:p></o:p>
Am I using the wrong jdbc.jar version? I made sure that fetch, kx, jdbc.jar etc… were all in my path, but it still doesn’t work.<o:p></o:p>
Any ideas what went wrong?<o:p></o:p>
On Thursday, February 20, 2014 at 3:36:46 PM UTC+8, kuentang wrote:<o:p></o:p>
It seems to me you are still using an old version of jdbc.jar. kx has reorganized the jdbc.jar file and put c.jar in a package called kx. <o:p></o:p>
<o:p></o:p>
I can fetch timestamp.<o:p></o:p>
<o:p></o:p>
EDU>> javaaddpath ‘jdbc.jar’<o:p></o:p>
EDU>> q = kx.c(‘localhost’,8888)<o:p></o:p>
q =<o:p></o:p>
kx.c@24389c<o:p></o:p>
EDU>> fetch(q,‘.z.p’)<o:p></o:p>
ans =<o:p></o:p>
2014-02-20 07:32:23.179023<o:p></o:p>
<o:p></o:p>
Force an error:<o:p></o:p>
<o:p></o:p>
EDU>> fetch(q,‘.z.p+`a’)<o:p></o:p>
??? Java exception occurred:<o:p></o:p>
kx.c$KException: type<o:p></o:p>
<o:p></o:p>
at kx.c.k(c.java:103)<o:p></o:p>
<o:p></o:p>
at kx.c.k(c.java:104)<o:p></o:p>
<o:p></o:p>
at kx.c.k(c.java:105)<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
Error in ==> fetch at 65<o:p></o:p>
t = c.handle.k(varargin{1});<o:p></o:p>
<o:p></o:p>
Can you make sure you are using the latest jdbc.jar file. And if it is still not working can you provide a standalone example with q and matlab scripts?<o:p></o:p>
<o:p></o:p>
Kim<o:p></o:p>
<o:p></o:p>
Von: personal…@googlegroups.com [mailto:personal…@googlegroups.com] Im Auftrag von Manish Patel
Gesendet: Donnerstag, 20. Februar 2014 08:19
An: personal…@googlegroups.com
Betreff: Re: [personal kdb+] kdb query in matlab r2013a<o:p></o:p>
<o:p></o:p>
things may have changed in last couple of years when i looked at matlab+q but the matlab bridge didn’t seem to support timestamps at that time. Workaround was to cast to a datetime. It looks like you’re only on minute resolution anyway, so hopefully not a problem for you.<o:p></o:p>
<o:p></o:p>
Otherwise if you really need nanos, you can convert to a long.<o:p></o:p>
<o:p></o:p>
On Thu, Feb 20, 2014 at 12:46 AM, Chao LI <lichao…@gmail.com> wrote:<o:p></o:p>
hi all,<o:p></o:p>
i can connect to my kdb session from matlab r2013a<o:p></o:p>
>> tab=fetch(q,‘select price:0.5*alast+blast, volume from data where date.year=2013’)<o:p></o:p>
<o:p></o:p>
tab = <o:p></o:p>
<o:p></o:p>
price: [388998x1 double]<o:p></o:p>
volume: [388998x1 double]<o:p></o:p>
<o:p></o:p>
however when my fetch query involves timestamp, i will get a type error<o:p></o:p>
<o:p></o:p>
>> tab=fetch(q,‘select time, price:0.5*alast+blast, volume from data where date.year=2013’)<o:p></o:p>
Error using kx/fetch (line 65)<o:p></o:p>
Java exception occurred:<o:p></o:p>
c$KException: type<o:p></o:p>
at c.k(c.java:101)<o:p></o:p>
at c.k(c.java:102)<o:p></o:p>
at c.k(c.java:103)<o:p></o:p>
<o:p></o:p>
the time colume is of format date+“p”<o:p></o:p>
2013.01.04D00:44:00.000000000 <o:p></o:p>
the query above doens’t work even if i change time to time.time or time.date<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
thanks<o:p></o:p>
C<o:p></o:p>
–
Submitted via Google Groups