Import and export excel files

조회 수: 2 (최근 30일)
Cheeesepondue
Cheeesepondue 2018년 12월 29일
편집: per isakson 2018년 12월 29일
Hello everyone,
I am trying to collect data of column "C" from each excel file and export the data into an excel file using for loop function.
When I open up the exported file "Load_of_samples", All data are the same as the column of the "first" excel file. (column A is the data from the first excel file, and the rest of columns (B~D) are the same as column A.
I am wondering what I did wrong.
Thank you.
XLfile = dir('*.csv');
number_of_files = length(XLfile);
OutputFileName = 'Load_of_samples';
for i = 1:number_of_files
filename = XLfile(i).name;
for i = 1:number_of_files
A(:,i) = xlsread(filename,1,'C:C');
end
xlswrite(OutputFileName,A);
end

답변 (1개)

madhan ravi
madhan ravi 2018년 12월 29일
  댓글 수: 4
madhan ravi
madhan ravi 2018년 12월 29일
Thank you sir Walter :-)
Cheeesepondue
Cheeesepondue 2018년 12월 29일
@Water Roberson The problem was the length of rows was different for each excel files.. So now I need to work on that.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by