• Search
  • Register
  • Log in
  • The Math Root » Matlab
  • How to import multiple excel files into matlab
  •  
    User has not uploaded an avatar

    I have a code to import an excel file into matlab but I need to import around 250 of these files. Does anyone know how to write a loop for this or is there another way to load them all at one? The code I am using is below.

    data = importdata('filename')

    textdata = data.textdata;

    data = data.data;

    t_date = datenum(textdata(:,1),2);

    x_date = datenum(textdata(:,3),'mmmyy');

    yr = year(x_date);

    mth = month(x_date);

    for i=1:length(x_date)

    calend = calendar(yr(i),mth(i));

    if calend(1,1:6) == zeros(1,6)
    dy = calend(4,6);
    else
    dy = calend(3,6);
    end

    x_date(i) = datenum(yr(i),mth(i),dy);

    end

    calput = 1.*strcmp(textdata(:,4),'C') + 2.*strcmp(textdata(:,4),'P');

    #28
    sally1987
    Member
    Posted 2 months ago
    RSS feed for this topic  

    Reply

    You must log in to post.

     © 2009 Anil Kandangath. All posts are owned by the whoever posted them. Share your knowledge.
    The Math Root is proudly powered by bbPress.. This site is not affiliated with The MathWorks™ or Wolfram Research. //   Theme by Mike Lothar  
    [ Time : 0.184s | 9 Queries ]