Reading specific data from an excel file

10 views (last 30 days)
Konstantinos
Konstantinos on 24 Jun 2014
Answered: Elijah Uche on 27 Oct 2014
Hi,
I have an excel file that contains a number of columns. What I want to do is to read the elements of one column ( for example column C) and when the string 'delta' is read at this column then read the respective element of another column (for example column I) and save it to a vector. What I have done is:
ind=find(ismember(xlsread('test.xlsx', 'C:C'),'delta'))
D = xlsread('test.xlsx', 'Iind:Iind')
but the ind that is returned contains more positions of 'delta' than the ones that actually are and 'Iind:Iind' to define the range of the elements in column I that I want to read is not accepted.
Any help on that? Thanks in advance

Answers (3)

Elijah Uche
Elijah Uche on 27 Oct 2014
The above solutions are not quite clear to me. My question though is a bit different. 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 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

David Sanchez
David Sanchez on 24 Jun 2014
I think it would be better to read just once the *.xls file, since it is a time-consuming process. And moreover, after reading your *.xls you will have all your data into matrix and cell format which can be easily manipulated in Matlab.
Your search will be performed much faster and easier.

Konstantinos
Konstantinos on 24 Jun 2014
If I read the *.xls file first then all the non numeric values are changed to 'NaN' so after that it is not possible to realize which elements are 'delta' in the column. (forgot to mention that I have numbers and several stings as elements of the column that contains the 'delta')

Tags

Community Treasure Hunt

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

Start Hunting!