MATLAB: Xlsread function: How to only get certain info from Excel Spreadsheets

#xlsread #cleaningMATLAB

Hello, how do only get certain parts of an Excel Spreadsheet onto a MATLAB script? For example, I only want to include cells G2:W2 from the spreadsheet, (which is just a fake answer key for a multiple-choice part of a given quiz), so how do I do this? I know that I have to use the xlsread function. What I have so far is:
[num,txt,raw] = xlsread(quiz_results.xslx')
Thank you!

Best Answer

>> help xlsread
xlsread Read Microsoft Excel spreadsheet file.
[NUM,TXT,RAW]=xlsread(FILE) reads data from the first worksheet in the Microsoft
Excel spreadsheet file named FILE and returns the numeric data in array NUM.
Optionally, returns the text fields in cell array TXT, and the unprocessed data
(numbers and text) in cell array RAW.
[NUM,TXT,RAW]=xlsread(FILE,SHEET) reads the specified worksheet.
[NUM,TXT,RAW]=xlsread(FILE,SHEET,RANGE) reads from the specified SHEET and RANGE.
Specify RANGE using the syntax 'C1:C2', where C1 and C2 are opposing corners of
the region. Not supported for XLS files in BASIC mode.