How would automatically import excelfiles into MATLAB?

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

Thank guys. Even last, I'm sorry I did not get the help you gave me an answer.
SO, data{i} is organized 1x5 cell. good!!
But I want the average value of each cell.
Each cell is organized about 1500x7 matrix.
Where I put the fuction related average ?
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개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

태그

질문:

2016년 5월 3일

댓글:

2016년 5월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by