Author Topic: Copying data from 1 excel file into another  (Read 665 times)

Offline sneakyben

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
Copying data from 1 excel file into another
« on: June 15, 2010, 01:48:53 PM »
Hi,
I am quite new to MATLAB and wish to do the following:
(I have searched for previous posts on this topic, but could find nothing that answers my questions)
 
I wish to write a script that will do the following, please could someone tell me how?

I have a directory that contains ten .xls files...

I want to copy the info from cells A100 to A110 from the 1st .xls file and put them in a new .xls file in cells A1 to A10...

Then I want to copy cells A100 to A110 from the 2nd .xls file into the .xls file described above in cells B1 to B10...

and so on... until all .xls files have had data copied from them into the new .xls file

Offline hero_hont

  • Newbie
  • *
  • Posts: 12
  • Matlab Forum
    • View Profile
Re: Copying data from 1 excel file into another
« Reply #1 on: August 21, 2010, 02:29:12 PM »
Hi,
I am quite new to MATLAB and wish to do the following:
(I have searched for previous posts on this topic, but could find nothing that answers my questions)
 
I wish to write a script that will do the following, please could someone tell me how?

I have a directory that contains ten .xls files...
I want to copy the info from cells A100 to A110 from the 1st .xls file and put them in a new .xls file in cells A1 to A10...
Then I want to copy cells A100 to A110 from the 2nd .xls file into the .xls file described above in cells B1 to B10...

and so on... until all .xls files have had data copied from them into the new .xls file


hello you..
i thinks you using xlsread and xlswrite when you copy cells A100 to A 1100 from 2nd.xls ...
ex:
data=xlsread('dulieu.xls','sheet2');
g=0;% khoi tao du lieu
tapkiemtra=[];
for i=1:length(data)
    if maukiemtra==data(i,1)
        z=1;
        g = i
    else
        z=0;
    end
       tapkiemtra=[tapkiemtra z]
end
    t=sum(tapkiemtra)
    if t>0
    %tapkiemtra1=tapkiemtra
    %sothutu1=g
    sothutu=g+1;
    so=num2str(sothutu);
   
 %so=num2str(m11);
 %-------------------------du lieu ma vach--------------------------------------------%
 load vi_tri
  [data11,txt]=xlsread('dulieu.xls','sheet1',['A',so,]) ;
  data11=xlsread('dulieu.xls','sheet1',['B',so,]);

you referece,,, :)

Matlab and SimuLink Development Forum

Re: Copying data from 1 excel file into another
« Reply #1 on: August 21, 2010, 02:29:12 PM »