I am stuck with inserting data into my MS Access Database. I already converted the data into cell array but it still returns me the error indicating that I am inputting the wrong data type.
1 回表示 (過去 30 日間)
古いコメントを表示
C =
'SGX 8873 K'
>> iscell(C)
ans =
1
>> datainsert(conn,'VehicleLocation','col2','C')
Error using database/datainsert (line 58)
Input data must be a cell array or numeric matrix.
Been stuck on inserting the data into the database for quite some time now. The input data 'C' is already verified as cell array by the command iscell(C). Anybody got any idea what am I doing wrongly? Thanks.
3 件のコメント
Walter Roberson
2015 年 5 月 20 日
Umakant, examine the below:
>> 'ABC'
ans =
ABC
>> {'ABC'}
ans =
'ABC'
When you see a string with quotes around it and indented, that is indicating a cell array containing the string; if it were a plain string then it would be displayed without the quote marks or indentation.
回答 (3 件)
the cyclist
2015 年 5 月 20 日
編集済み: the cyclist
2015 年 5 月 20 日
Guessing you want to remove the quotes from around C in the datainsert statement. You are trying to insert the single character 'C', rather than your variable C.
1 件のコメント
Walter Roberson
2015 年 5 月 20 日
datainsert(conn,'VehicleLocation', {'col2'}, C)
The column names must be cell array of string.
2 件のコメント
Walter Roberson
2015 年 5 月 20 日
Sorry, I do not have that toolbox, so I cannot check the code to see what is happening.
Thomas Koelen
2015 年 5 月 20 日
Are you sure you already created a database?
5 件のコメント
Walter Roberson
2015 年 5 月 20 日
You do not have a column named 'col2', you have a column named 'LicensePlate'
参考
カテゴリ
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!