Interfacing KDB with Matlab without Matlab plugin

Newer version Matlab provides a kdb+ integration plugin to easily load data from KDB+ database into Matlab. But not everyone has a new version Matlab. Still want to access KDB+ data and utilize Matlab’s great data analysis power? No problem. It is easy!

Basically, you simply need to use Matlab’s Java compatibility (or other compatibility) to use java2kdb API.

  • Compile the official c.java code and put all the *.class file into your Matlab java classpath. Or use ‘javaaddpath /the/path/totheclassfile/’
  • Create connector: >> conn = c(‘server’,port);
  • Query: >> v = conn.k(‘select time, price from quote’);
  • The v is a Java c$Flip object where v.x is column names, v.y are the values
  • Then you simply need to convert the Java objects, no matter string or double or timestamp, into Matlab’s internal data types. Simple, right? Some more hint, use cell(), cellfun().
Advertisement

Tags: , , , ,

One Response to “Interfacing KDB with Matlab without Matlab plugin”

  1. brainyoga Says:

    thanks. Similar to http://www.sinv.de/slog/?p=20

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.