Create a table in MatLab with specific data in different spreadsheets in one Excel File.

5 ビュー (過去 30 日間)
Hello together,
I have an Excel File with 10 spreadsheets and I want to import data (always range: A2:K7) from every spreadsheet into a table in MatLab. I want to create a Loop so that the data is displayed beneath one another.
Thank you for your support!

採用された回答

Stephan
Stephan 2019 年 10 月 19 日
編集済み: Stephan 2019 年 10 月 19 日
Use the sheet option from the readtable function to loop through the single sheets. Indexing the values correctly in the table you create will let the data appear the way you want. in the given link you also find how to select the range of the Excel document.
  5 件のコメント
Stephan
Stephan 2019 年 10 月 21 日
filename = 'NASDAQ Company Data.xlsx';
sheets = sheetnames(filename);
xlRange = 'A1:K7';
data = cell(numel(sheets),1);
for k = 1:numel(sheets)
data{k} = readtable(filename,'Sheet',sheets(k),'Range',xlRange,...
'PreserveVariableNames',true);
end
Leon Wohlgemuth
Leon Wohlgemuth 2019 年 10 月 21 日
Thank you so much!

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

その他の回答 (0 件)

カテゴリ

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