user3368213
user3368213

Reputation: 21

error: too many many input arguments matlab

I am trying to execute a Sql query in matlab. The sql uses 'select' command for selecting a particular row using a columnname which matches a value that is stored in variable given in the following code. When I execute this , I get an error : Error using ==> database.exec Too many input arguments.

q=value;%computed value. 
conn1=database('Dbname','',''); 
fna=exec(conn1,'select * from table1 where ImageName="',q,'"');
fna=fetch(fna); fda=fna.data;

Upvotes: 1

Views: 685

Answers (2)

Daniel
Daniel

Reputation: 36710

You are passing four input arguments, the last three ones must be concatitated to one sql command.

sqlquery=['select * from table1 where ImageName="',q,'"'];
fna=exec(conn1,sqlquery);

Upvotes: 1

Steffen Nieuwenhoven
Steffen Nieuwenhoven

Reputation: 525

in the matlab manual it says that exec has the following syntax:

curs = exec(conn,sqlquery)
curs = exec(conn,sqlquery,qTimeOut)

You have four parameters in the exec functions, that's what the error means!

Upvotes: 0

Related Questions