Export Data to Ms Access - HELP!!
2 次查看(过去 30 天)
显示 更早的评论
Hello!!
I have tried many ways/tutorials on how to export data from MATLAB to Ms Access, but so far, I haven't fully succeed. I could export all my dataset into 1 column instead of 1 row.
Could you guys please help me??
Thanks in advance.
Here's my code:
colnames - cell array with Column Names <1 x 44>
data - cell array with data set to export to Ms Access <15 x 44>
handles.DB.con - Database connection object.;
datainsert(handles.DB.con,'databaseTable', colnames, data);
error:
Error using database/datainsert (line 104)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
5 个评论
Friedrich
2013-10-14
I assume it's related to a column name. Maybe one contains a reserved word. Can you post all the columnnames here? The easiest would be
celldisp(colnames)
采纳的回答
Friedrich
2013-10-14
编辑:Friedrich
2013-10-14
Hi,
yes DATE is a reserved keyword. For a full list see here. You can stil use it but you should escape any column names which are also keywords or functions. In MS Access it should be [] brackets. So instead of 'Date' use '[Date]' as column name.
3 个评论
Friedrich
2013-10-14
编辑:Friedrich
2013-10-14
Maybe there are others? The error is given from the driver directly and not from MATLAB. It must be something with the syntax which MATLAB uses to run the SQL command internally.
Maybe start with a dummy database containing one column name and see if it works. if so add a 2nd column and try again. This will lead to the column name which causes the troubles here.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!