Extract data from excel using heading
8 views (last 30 days)
I have my data in an excel file. I want matlab to extract data and make a matrix from 9 places that have the same heading and the same length. The data is all located in the same column in the excel file. The locations vary between different excel files, so I want to use the heading to find data in the file not the location.
David Sanchez on 9 Jun 2014
[data headings] = xlsread('your_excel.xls');
headings = headings(1,:);% first row of headings, in case you have some others.
head_wanted = 'your_desire_heading'; % heading of your desired column
col_desired = getnameidx(headings, head_wanted); % position of your wanted column
your_wanted_data = data(:,col_desired);
More Answers (1)
Sean de Wolski on 9 Jun 2014
Use a table, that way you can index by variable name.
Attach an Excel sheet with specific instructions if you'd like a minimal working example.