User`s guide

cols
7-13
cols
Retrieve number of columns in fetched data set
Syntax
numcols = cols(curs)
Description
numcols = cols(curs) returns the number of columns in the fetched data set curs.
Examples
Display the Number of Columns in a Data Set
Create a database connection conn using the dbtoolboxdemo data source.
conn = database('dbtoolboxdemo','','');
Working with the dbtoolboxdemo data source, use fetch to import all data into
Database Cursor Object curs. Store the data in a cell array contained in the cursor
object field curs.Data.
curs = exec(conn,'select * from productTable');
curs = fetch(curs);
View the contents of the Data element in the cursor object.
curs.Data
ans =
[ 9] [125970] [1003] [13] 'Victorian Doll'
[ 8] [212569] [1001] [ 5] 'Train Set'
[ 7] [389123] [1007] [16] 'Engine Kit'
[ 2] [400314] [1002] [ 9] 'Painting Set'
[ 4] [400339] [1008] [21] 'Space Cruiser'
[ 1] [400345] [1001] [14] 'Building Blocks'
[ 5] [400455] [1005] [ 3] 'Tin Soldier'