MATLAB Answers

How to paste cell values from multiple excel sheets?

Asked by NICHOLAS TAVOUKTSOGLOU on 22 Apr 2013

Hi I have a problem. I have 1080 excel files named from '1' to '1080' and I would like to copy several values from each file to one master spreadsheet (the corresponding cells are the same in every file). I tried to use the 'get' command in a loop but I keep getting error mesages.

Can anyone help me by providing a sample code or example?

thank you in advance

  0 Comments

Tags

Products

No products are associated with this question.

1 Answer

Answer by per isakson
on 22 Apr 2013

Try

    doc xlsread

  2 Comments

Thank you it worked just fine. There is one more thing I want to do. I would like to save all these values into 1Xi matrix. I am doing something wrong because I keep getting 'Subscripted assignment dimension mismatch.' error. If you could help me on this it would be perfect!!

per isakson
on 23 Apr 2013

You have to provide more detail.

Something like this will store all data

    MAT = nan( n, m, 1080 );  % allocate memory
    for ii = 1 : 1080
        MAT( :, :, ii ) = xlsread( sprintf( 'filename%i.xls', ii ) );
    end

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today