Clear Filters
Clear Filters

Reading an element from Excel files

2 views (last 30 days)
Elijah Uche
Elijah Uche on 27 Oct 2014
Answered: Geoff Hayes on 27 Oct 2014
I want to read a particular element from an Excel file which has for example 500 rows and 3 columns. I am interested in the element in the 200th row and second column. I have 1000 of these files in a particular folder. How do I read and extract this particular element from all the files so I could analyse and plot a graph with what's extracted instead of manually going through each of the 1000 files to get these elements? Thank you Uche

Answers (1)

Geoff Hayes
Geoff Hayes on 27 Oct 2014
Elijah - try using xlsread to get the 200th element of the second column. If you have a list of *.xlsx files, then as you iterate through this list, just read the single element from each file and store it in an array
x(k) = xlsread(myFilename,'B200');
myFilename is just a local variable representing the kth filename (say, 'myFileK.xlsx'). You may need to supply the worksheet name before the 'B200' string. See the xlsread documentation for details.

Community Treasure Hunt

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

Start Hunting!