How can I only use a certain set of rows based on a string when reading an excel file?

1 view (last 30 days)
So I'm doing a matlab project and we have to read a set of basketball games with xls read and we can only use the SEC conference games to create a table of slightly different data thats in the excel sheet. We can't figure out how to only use the data in the SEC game rows and then print a different table. We created [num text all] = xlsread(filename) and seperated the conference column from the rest. How do we create a variable (secGames) that is composed of only the SEC conference games from the conference column with only the rows of those games and certain columns from the excel spreadsheet?
  3 Comments
Carson
Carson on 9 Apr 2014
We haven't learned either of those functions and we get points off for using things we haven't learned. Is there a way to achieve this without using those functions?
dpb
dpb on 9 Apr 2014
Well, one must assume there is or it wouldn't have been the assignment...
The pdf mentions things about a previous algorithm and some algorithm in class so I'd presume there would be the place to start. I can't guess effectively at what you have or have not, had so far, sorry.

Sign in to comment.

Answers (1)

Carsci
Carsci on 9 Apr 2014
Edited: Carsci on 9 Apr 2014
You are allowed to use xlsread, right? So it seems this provides a way to do it.
Assume the SEC data is on contiguous rows. Use xlsread 2 times. Read the header rows in one range and the SEC rows in another. Determining the ranges manually is not ideal but you may not yet have learned any functions that do it programatically.
You can expand the multiple use of xlsread to extract only the columns of interest as seperate reads. It is messy as each range has to be rectangular but if you are only allowed to use a limited set of functions then may allow a solution.
[num,txt,raw] = xlsread(filename,range) reads data from the specified range of the first worksheet in the file. Specify range using the syntax 'C1:C2', where C1 and C2 are two opposing corners that define the region.

Community Treasure Hunt

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

Start Hunting!