User`s guide

7 Functions — Alphabetical List
7-16
columnnames
Retrieve names of columns in fetched data set
Syntax
columnlist = columnnames(curs)
columnlist = columnnames(curs,returnCellArray)
Description
columnlist = columnnames(curs) returns the column names of the data selected
from a database table in the cursor object curs. The columnnames function is not
supported for a cursor object returned by the fetchmulti function.
columnlist = columnnames(curs,returnCellArray) returns the column names
as a cell array of strings when returnCellArray is set to true.
Examples
Return Column Names from the Selected Data
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.
curs = exec(conn,'select * from suppliers');
curs = fetch(curs);
Return the column names in the suppliers table.
columnlist = columnnames(curs)
columnlist =