How to Text Scan and remove columns full of zeros?
Show older comments
I am scanning in large data sets and many of them have multiple fields that don't have data (recorded as 0). How would I use text scan to get the data into Matlab and remove any columns with 0s and move all columns over to not leave empty space in the resulting array? I attached a sample text file (tab delimited). The columns with zeros are not always the same, I need to somehow dynamically figure out which columns have 0s and remove them (the entire column needs to be removed, including the header)
Accepted Answer
More Answers (1)
Andrei Bobrov
on 15 May 2017
T = T(:,any(T{:,:}));
Categories
Find more on Text Files in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!