MATLAB: Using xlsread to select non-consecutive rows from excel spreadsheet

importing excel dataMATLABnon-consecutive dataxlsread

Hello, I am trying to find out wether it is possible to use xlsread(filename,-1) to select several rows from an excel spreadsheet that are not consecutive? In more detail, from a large spreadsheet, I want to (manually) select all the rows where certain items fulfill certain requirements – but these requirements change everytime I run the program.
For example, once I want to select all rows, where column 5 contains a certain value and column 21 is not empty – those might be rows 84, 319, and 762. An other time, I want to select all rows which contain a value bigger than 1 in column 7, a certain string in column 33, and a different string in column 120. There might be 14 rows left fulfilling those criteria. By using the filtering option in the excel file, I can easily find out which rows I need to select, but the question is: how can I get this information into Matlab?
Since I'm trying to figure this out for quite a while and all the questions and answers didn't give a solution, I really hope someone can help! Thank you in advance!

Best Answer

If you want to apply a condition to the values inside Matlab, you have to import all data at first, check the condition and selected the matching data afterwards. You cannot let Matlab magically consider the values of the data without importing them at first.