我正在尝试在matlab中执行Sql查询。 sql使用'select'命令使用列名选择特定行,该列名与存储在以下代码中给出的变量中的值相匹配。 当我执行此操作时,出现错误:使用==>时出错database.exec输入参数太多。
q=value;%computed value.
conn1=database('Dbname','','');
fna=exec(conn1,'select * from table1 where ImageName="',q,'"');
fna=fetch(fna); fda=fna.data;
答案 0 :(得分:1)
您正在传递四个输入参数,最后三个必须连同一个sql命令。
sqlquery=['select * from table1 where ImageName="',q,'"'];
fna=exec(conn1,sqlquery);
答案 1 :(得分:0)
在matlab手册中,它说exec具有以下语法:
curs = exec(conn,sqlquery)
curs = exec(conn,sqlquery,qTimeOut)
exec函数中有四个参数,这就是错误的含义!