how to insert date and time in database table using matlab database toolbox
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lloyd
am 24 Okt. 2013
Kommentiert: the cyclist
am 25 Okt. 2013
is it possible to insert the current time in table using the code datestr(now);? I am getting this error
Error using database/fastinsert (line 86) Input data must be a cell array, matrix, or structure
Error in licenseplate>pushbutton23_Callback (line 615) fastinsert(conn,tableName,colnames2,txt);
in the command window.
here's the code:
conn = database('vlmsystem','admin','admin');
dbpath = 'C:\Users\Sony Vaio\Documents\Task\0.1 Systems\System 1 - edited\Appendix\vlogdbase.mdb';
tableName = 'vehicleLog';
colnames = {'plate_number','date_time','login_logout'};
colnames1 = {'plate_number'};
colnames2 = {'date_time'};
colnames3 = {'login_logout'};
txt = datestr(now);
fastinsert(conn,tableName,colnames2,txt);
close(conn);
0 Kommentare
Akzeptierte Antwort
the cyclist
am 24 Okt. 2013
Does it work if you put your result in a cell array?
txt = {datestr(now)};
3 Kommentare
the cyclist
am 25 Okt. 2013
Yes. datestr() accepts a second input argument for the format. Try
datestr(now,'yyyy-mm-dd HH:MM:SS')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Database Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!