Why does sqlread() not work?
Ältere Kommentare anzeigen
I am trying to use sqlread() to import data from SQLite. I tried to use the sqlread() function in the following manner, exactly like the documentation examples, and I get the following error "Unrecognized function or variable 'sqlread'". I'm using MATLAB R2021a (sqlread introduced in R2018a).
I was able to import the data by replacing sqlread() with fetch() but I do not understand why sqlread() does not work.
conn = sqlite("path_to_sqlite_db.db", 'readonly');
data = sqlread(conn, "my_table_name");
close(conn);
2 Kommentare
Cel Kulasekaran
am 29 Sep. 2022
did conn established correctly? sqlread won't work otherwise.
Alex
am 29 Sep. 2022
Antworten (2)
Cel Kulasekaran
am 30 Sep. 2022
0 Stimmen
@Alex, Walter is sort of right.
If you want to use sqlread with a sqlite connection, you will probably have to establish that connection using the jdbc driver, then you can use sqlread. See details (section on how to programatically do this in the middle of the article: SQLite JDBC for Windows - MATLAB & Simulink (mathworks.com)
Otherwise, just use fetch.
Walter Roberson
am 30 Sep. 2022
0 Stimmen
https://www.mathworks.com/help/database/ug/sqlite.sqlread.html
sqlread() for sqllite() requires r2022a or later; you are using r2021a.
1 Kommentar
Alex
am 30 Sep. 2022
Kategorien
Mehr zu Database Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!