MATLAB: How to remove a row based on text in a certain column


I'm trying to make a parser for either a .txt or .xlsx file (data can be easily converted,) but I want to omit certain lines that contain an error message. The spreadsheet has a over 100k lines and a majority of them are errors produced by the system. The error lines contain [warning] and that is the only identifier that I need to use to omit them. I've attached a screenshot of part of the data to show the format of the line. If I can post anything else that'd help let me know. Here's what I've tried so far:
DFTable(any(strcmp(table2cell(DFTable), [warning]),2), :) = []

Best Answer

  • mask = contains( string(DFTtable{:,3}), '[warning]');
    DFTable(mask,:) = [];