How to read external file data from a .xls file into matlab

4 ビュー (過去 30 日間)
Anunay Kris
Anunay Kris 2011 年 3 月 14 日
コメント済み: Kalpesh Nayak 2016 年 11 月 25 日
Hi,
Can anyone tell me how to read external file data like author, date created, date modified etc.. from an excel file into matlab.

回答 (2 件)

Jiro Doke
Jiro Doke 2011 年 3 月 15 日
If you're on Windows, you can use the COM client support to do it. You can make use of the BuiltinDocumentProperties of the Workbook object (VBA).
% Connect to Excel
Excel = actxserver('excel.application');
% Get Workbook object
WB = Excel.Workbooks.Open(fullfile(pwd, 'Book1.xlsx'),0,true);
% Get Document Properties
x = WB.BuiltinDocumentProperties;
% Get Author
y = get(x, 'Item', 'Author');
author = get(y, 'Value')
% Get Creation Date
y = get(x, 'Item', 'Creation Date');
date_created = get(y, 'Value')
% Get Last Save Time
y = get(x, 'Item', 'Last Save Time');
date_modified = get(y, 'Value')
% Close Workbook
WB.Close();
% Quit Excel
Excel.Quit();

Sisi Ma
Sisi Ma 2011 年 3 月 15 日
you mean the property of a xls file? try putting those xls files in your current directory and do:
dir('*.xls')
  1 件のコメント
Kalpesh Nayak
Kalpesh Nayak 2016 年 11 月 25 日
Hi Jiro Doke,
Can you please tell how to change this properties of existing document. and save it.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by