采用matlab访问数据库 matlab 2018b(2020a也可)

%% 采用matlab访问数据库
conn = database('labmysqltraincourse','root','12345','Vendor','MYSQL','Server','localhost','PortNumber',3306);
data = fetch(conn,['SELECT * ' ...
    'FROM labmysqltraincourse.student']);
close(conn)
clear conn

 

 

 

 

%% 采用matlab访问数据库
conn = database('centralsystem','root','pkujrk','Vendor','MYSQL','Server','192.168.0.4','PortNumber',3306);
data = fetch(conn,['SELECT de FROM centralsystem.experimentdata where datanum = ''d00003'' and pid = 11']);
close(conn);
clear conn;

 

两个双引号,相当于一个单引号
 

posted @ 2019-11-20 16:46  bH1pJ  阅读(34)  评论(0编辑  收藏  举报