How would automatically import excelfiles into MATLAB?

1 回表示 (過去 30 日間)
JIN-HWA JEONG
JIN-HWA JEONG 2016 年 5 月 3 日
コメント済み: Image Analyst 2016 年 5 月 3 日
Hi, guys. I want to automatically import excelfiles into MATLAB. I use this code.
--------------------------------------------
source_dir = 'C:/Users/Cju/Documents/MATLAB/a' ;
source_files = dir(fullfile(source_dir, '*.xlsx'));
for i = 1:length(source_files) ;
data(i) = xlsread(fullfile(source_dir, source_files(i).name));
end
--------------------------------------------
But just import final file. What is wrong?

採用された回答

Image Analyst
Image Analyst 2016 年 5 月 3 日
Chances are that won't work unless your workbooks have only a single scalar value in them. You would need data to be a cell array
data{i} = xlsread(.......
  3 件のコメント
JIN-HWA JEONG
JIN-HWA JEONG 2016 年 5 月 3 日
Where I put the fuction related average ?
Image Analyst
Image Analyst 2016 年 5 月 3 日
Just put this in the loop after you read in data{i}:
for k = 1 : length(data{i})
theMean(i, k) = mean(data{i});
end

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

その他の回答 (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