MATLAB: Writing a loop to import and save multiple excel sheets onto matlab individually

data importfor loopimporting excel datamultiplesave

I have 300 excel sheets with data with 3 rows and variable lengths. I would really appreciate it if anyone knows how I can import these and save them with the same name as the excel sheet that each matrix corresponds to. I can pull up the data using this: xlsread('firstdataset.xlsx','0001','B7:E100');
However, I need to make a for loop such that the sheet goes from 0001 to 0320 (and the zeros need to be there before the number). I also would like to eliminate rows of zeros for matrices that have shorter lengths.
I would really appreciate any help. Thank you!

Best Answer

The code ended up being very simple and I thought I would share it in case anyone wanted it:
n=200; for i=1:n k=sprintf('%04d',i); a{i}=xlsread('firstdataset.xlsx',k,'C1:E75'); end
Related Question