2016-07-25 28 views

回答

1

你可以查詢sqlite這個:PRAGMA table_info(name_of_your_table);。它會給你所有欄目的信息。

實施例:

% Assuming your JDBC driver is already added to your java path 

% create connection to database file 
conn = database('', '', '', 'org.sqlite.JDBC', 'jdbc:sqlite:C:\your_db.sqlite'); 

cursor = exec(conn, 'PRAGMA table_info(name_of_your_table);'); 
cursor = fetch(cursor); 

要輸出的列名,它靠的是稍有不同使用DataReturnFormatMatlab Documentation

  • Cellarray(默認)
% When DataReturnFormat is cellarray 
cursor.Data(:,2) % returns table column names 
  • 表格,數據集或結構
% When DataReturnFormat is table, dataset or structure 
cursor.Data.name