Hi I'm trying to export a table I've created in Matlab to an ODBC database. The table is set up with four columns (trade_date, ticker, curve_date, price). These columns are (datetime, char, datetime, double) datatypes, when i execute the command to write to my database (as i have before using only a table with all data being of type Double), i get the following:
Commands:
conn = database.ODBCConnection('DBName','','');colnames = {'trade_dt','ticker','curve_dt','price'};datainsert(conn, 'matlab.tblFwds', colnames, t);
summary(t) gives me:
summary(t)Variables: trade_dt: 110×1 datetime Values: min 19-Oct-2016 median 19-Oct-2016 max 19-Oct-2016 ticker: 110×21 char curve_dt: 110×1 datetime Values: min 01-Nov-2016 median 16-May-2021 max 01-Dec-2025 price: 110×1 double Values: min 19.5 median 23.675 max 48.25
and the error i get when trying to insert into the database is:
Error using database.internal.utilities.DatabaseUtils.validateStruct (line 78)Input structure, dataset or table incorrectly formatted. See help for detailsError in database.odbc.connection/insert (line 114) data = database.internal.utilities.DatabaseUtils.validateStruct(data);Error in database.odbc.connection/datainsert (line 40)insert( connect,tableName,fieldNames,data );Error in MorningstarHistoricalCurves (line 68) datainsert(conn, 'matlab.tblGasFwds',colnames, t);
I would appreciate any help on how to insert this table/data into my database, any examples using dates would be greatly appreciated! Thanks in advance!
Matt
Best Answer