How can I only use a certain set of rows based on a string when reading an excel file?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2014-4-9
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.
回答(1 个)
Carsci
2014-4-9
编辑:Carsci
2014-4-9
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!