Can xlsread or some other function be used to import filtered data from excel table?

8 views (last 30 days)
I have an excel sheet that has a formatted table. Applying filters to a column greatly reduces the amount of rows in the table. I would like to be able to take this filtered data and have matlab import only the filtered portion to run through functions for processing. Is this something that is possible for matlab to automatically do, or would i need to physically copy and paste the filtered data in excel and save to another sheet that matlab reads from?
[Merged from earlier question that this one duplicated]
My excel file consists of a formatted table, with each column header giving the option to filter the rows by the data in that column. For example, in a temperature column values range from 0 to 100 Celsius. By clicking the filter I can select to only see rows at 50 degrees celsius. When I apply filters like this and save the file I want to use my gui to read the excel file like normal, but I want it to only read the rows that remain after the filter. When I tried this in matlab, it still reads all the rows in the file and seems to ignore the filter option. Is there a way to do this?

Answers (1)

Walter Roberson
Walter Roberson on 29 Jan 2016
If it can be done (not sure) then it would require that you use MS Windows with Excel installed and create an ActiveX connection to do the reading. You can see the techniques used in the File Exchange contribution "xlsread1"
  2 Comments
Guillaume
Guillaume on 30 Jan 2016
Edited: Guillaume on 30 Jan 2016
It can be done of course, anything you can do manually in excel, you can do programmatically. And indeed it will involve activeX.
The difficulty is figuring which excel objects to manipulate and which methods to call. I'd recommend recording a macro of the filtering followed by a copy/paste operation and looking at the generated code for finding out the required calls.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!