Retrieve Double precision Values from a database
Show older comments
I have a database table that contains a two columns (X and Y) of double precision data. I wanted to retrieve these data to Matlab. I used the following code for doing this (Note that the ‘conn’ is the connection name.
curs = exec(conn, 'select x, y from Mytable');
setdbprefs('DataReturnFormat','cellarray');
curs = fetch(curs, 10);
AA = curs.Data;
Then I wanted to see all the X values and used the following code.
x=[AA{:,1}]'
The result is given below.
x =
1.0e+006 *
-2.6859
-2.6859
-2.6859
-2.6859
-2.6859
-2.6859
-2.6859
-2.6859
-2.6859
-2.6859
Please note that the result given by Matlab contains the TRUNCATED values of X.
Given below is the list of exact values for X in the database table.
-2685857.83152909 -2685873.29058222 -2685892.47755554 -2685878.77198631 -2685853.37410012 -2685864.72544327 -2685876.71371916 -2685886.58031066 -2685875.18191007 -2685856.28515618
I want to get these exact values to Matlab instead of the truncated values. Please help.
1 Comment
Devinya Herath
on 22 Aug 2011
Accepted Answer
More Answers (0)
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!