フィルターのクリア

Read Excel sheet (one after other )

2 ビュー (過去 30 日間)
b.m.n n
b.m.n n 2016 年 11 月 26 日
コメント済み: CA 2019 年 2 月 28 日
hello... i have 15 Excel sheet in one file .. i want put them in loop to read in matlap How can i do that? thankyou..

採用された回答

Walter Roberson
Walter Roberson 2016 年 11 月 26 日
The second output of xlsinfo can tell you the names of all of the sheets. You can then loop over them with xlsread
filename = 'YourInputFile.xls';
[~, sheets] = xlsinfo(filename);
num_sheets = length(sheets);
data = cell(num_sheets, 1);
for K = 1 : num_sheets
data{K} = xlsread(filename, sheets{K});
end
  2 件のコメント
b.m.n n
b.m.n n 2016 年 11 月 27 日
編集済み: b.m.n n 2016 年 11 月 27 日
thank you so much
CA
CA 2019 年 2 月 28 日
Hi,
Would this also work if I have a script that I need to run on multiple sheets within the same excel file?
So I would need it to run my whole script for sheet 1, then run my whole script for sheet 2, then for sheet 3 and so on....
If so, would it be a case of doing something like this?... Or would it be something completly different?
filename = 'YourInputFile.xls';
[~, sheets] = xlsinfo(filename);
num_sheets = length(sheets);
data = cell(num_sheets, 1);
for K = 1 : num_sheets
data{K} = xlsread(filename, sheets{K});
% % INSERT MY SCRIPT HERE % %
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by