Reading specific data from an excel file

13 ビュー (過去 30 日間)
Konstantinos
Konstantinos 2014 年 6 月 24 日
回答済み: Elijah Uche 2014 年 10 月 27 日
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

回答 (3 件)

Elijah Uche
Elijah Uche 2014 年 10 月 27 日
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 2014 年 6 月 24 日
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 2014 年 6 月 24 日
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')

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by