フィルターのクリア

XLSread - multiple sheets

18 ビュー (過去 30 日間)
Prathamesh Halagi
Prathamesh Halagi 2021 年 1 月 5 日
コメント済み: Ann 2021 年 1 月 9 日
Hello,
I have 215 excel sheets with similar data and each file has 4 sheets. Is there a way I can read all four sheets in a file in Matlab thorugh xlsread/import opts?
--
Thanks

採用された回答

Ann
Ann 2021 年 1 月 7 日
Hi, Pratha.
I'm not sure if it helps or not because I also have similar situation with you but my parameter can combine in one excel file.
TimeP1=xlsread('Book001.xlsx','PRN1','A:A');
PRNP1=xlsread('Book001.xlsx','PRN1','B:B');
S4P1=xlsread('Book001.xlsx','PRN1','C:C');
%_______________read PRN1_______________%
TimeP2=xlsread('Book001.xlsx','PRN2','A:A');
PRNP2=xlsread('Book001.xlsx','PRN2','B:B');
S4P2=xlsread('Book001.xlsx','PRN2','C:C');
%_______________read PRN2_______________%
In another word:
ParameterP1 = xlsread('your excel file with format','your tab name in that excel','column selected');
  2 件のコメント
dpb
dpb 2021 年 1 月 7 日
編集済み: dpb 2021 年 1 月 7 日
The above is quite inefficient in opening/closing the Excel workbook three separate times for each sheet; six times altogether in addition to the fact that xlsread is deprecated.
Use readtable instead
tTable1=xlsread('Book001.xlsx','Sheet','PRN1','Range','A:C');
Then reference the variables as
tTable1.Time
etc., ...
With multiple workbooks or sheets, you could further compact by using an array of tables.
Ann
Ann 2021 年 1 月 9 日
Thanks sir, for your recommendations and it do helps!

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

その他の回答 (1 件)

dpb
dpb 2021 年 1 月 5 日
xlsread has been deprecated; use readcell, readmatrix, readtable instead depending on how you want the data returned and the content of the spreadsheet.
None of these including xlsread has the facility to return more than a single sheet per invocation; you'll just have to loop over the sheets in each workbook in turn.

カテゴリ

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