Undefined function 'rows' for input arguments of type 'double'.
5 views (last 30 days)
Show older comments
How can I use the function "rows"? I have already installed the Database Toolbox but it is not working - or is it maybe the wrong toolbox? Thanks!
2 Comments
Geoff Hayes
on 14 Nov 2014
Tim - how are you using the function rows? From the link, the only input to this function is a database cursor. Please post your code where you invoke rows and include any relevant code that precedes it.
If you are unsure if you have this function, type the following in the Commadn Window
which rows -all
As I don't have the Database Toolbox, I observe the following
'rows' not found.
What do you see when you run this command?
Answers (1)
Geoff Hayes
on 14 Nov 2014
Tim - the rows function of the Database Toolbox is to be used with a database cursor only where it is specified as an open SQL database cursor object generated using fetch. See fetch for details. So suppose you want to select some data/records from one or more tables in a database (Oracle, SQL Server, Sybase, etc). You write the SQL command to do this (something like select * from ... where ...) and then you execute this command against the database of interest. The cursor can then contain the records that are returned (which may include numeric, string, date, etc. data).
Since you are passing a 2000x3 matrix of data type double into the rows function, then the error makes sense - your matrix sam is not a cursor and so the Undefined function 'rows' for input arguments of type 'double' error message is raised.
What is your intent behind the line of code
sam(:,4) = [1:1:rows(sam)]'
You are setting the fourth column of sam to a column starting at one and incrementing by one until "something" is reached. What is that "something"?
numRows = size(sam,1);
We use 1 since that corresponds to the first dimension of sam, which is the number of rows.
0 Comments
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!