# How to handle kdb data in Matlab

**URL:** <https://forum.kx.com/t/how-to-handle-kdb-data-in-matlab/7682>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [April 12, 2012, 7:32pm UTC](https://forum.kx.com/t/how-to-handle-kdb-data-in-matlab/7682 "2012-04-12T19:32:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weiyi\_Zhang](https://avatars.discourse-cdn.com/v4/letter/w/9de053/32.png) [@Weiyi\_Zhang](https://forum.kx.com/u/Weiyi_Zhang)\
**Post date:** [April 12, 2012, 7:32pm UTC](https://forum.kx.com/t/how-to-handle-kdb-data-in-matlab/7682/1 "2012-04-12T19:32:00Z")

</div>

Dear all,

I have a question about handle kdb data in Matlab.

In Matlab, how can I convert the date, time columns from java.Sql.Date/  
Time to matlab date, time format?  
And it’s there any easy way to convert to matlab when fetching the  
data from KDB?

Thank you.

\>\> conn = c(‘localhost’,8000);  
\>\> r=conn.k(‘select from AnalyticsOptTrds where date=2012.04.04, time within(13:30:00;14:00:00)’);  
r.x

ans =

java.lang.String:

‘date’  
‘time’  
‘sym’  
‘optric’  
‘maturity’  
‘opttype’  
‘strike’  
‘quotetype’  
‘eqttrdprx’  
‘eqtbidprx’  
‘eqtaskprx’  
‘opttrdprx’  
‘accvolume’  
‘trdvol’  
‘sufvol’  
‘delta’  
‘gamma’  
‘theta’  
‘vega’

\>\> r.y

ans =

java.lang.Object:  
[460x1 java.sql.Date]  
[460x1 java.sql.Time]  
[460x1 cell }  
[460x1 cell }  
[460x1 java.sql.Date]  
[460x1 int16]  
[460x1 single]  
[460x1 cell }  
[460x1 single]  
[460x1 single]  
[460x1 single]  
[460x1 single]  
[460x1 int32]  
[460x1 single]  
[460x1 single]  
[460x1 single]  
[460x1 single]  
[460x1 single]  
[460x1 single]
