Clear Filters
Clear Filters

Extracting data from excel

2 views (last 30 days)
Salaijobhaka
Salaijobhaka on 17 Apr 2017
Answered: dpb on 17 Apr 2017
Hi I would like to extract data from a column in which the second row contains string "P5" (Figure attached). One way is to use "xlsread('filepath/data.csv','DQ:DQ')". In this case one need to look at corresponding excel column index, i.e., "DQ". Is there a way in which one can extract data without looking at excel column index but using the string index, i.e., "P4" instead ?

Answers (1)

dpb
dpb on 17 Apr 2017
With "pure" Matlab-supplied functions, no. You would have to do it indirectly, reading the header row then finding the desired string location therein. As xlsread is quite slow already, almost surely at least as fast to simply just read the full sheet and save what you're interested in.
I'm sure it's also possible with COM to write specific commands but that becomes an Excel VBA syntax problem, not Matlab once the automation server is created.

Community Treasure Hunt

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

Start Hunting!