How to select multiple contain conditions in a table?
Show older comments
Hi, I'm basically trying to filter my results to remove irrelevant rows based on two string conditions. I've attached the xslx file. I need to know the specific cause when the operating mode is 'critical' and the LOOP category is 'WR'. Basically isolating all the rows in the table where my two conditions are met.
Data = readtable('LOOP Events.xlsx','Range','D2:K370'); % Load excel from specified sheet
%LOOPS = cat(2,Data(:,1),Data(:,2),Data(:,3));
LOOPS = cat(2,table2array(Data(:,1)),table2array(Data(:,7)));%,table2array(Data(:,8)));
LOOPS = LOOPS(~all(cellfun(@isempty,LOOPS),2),:);
substr = {'Critical','SEE','EEE'};
selectedcol = contains(LOOPS,substr);
Cause = Data(:,3);
Select_Cause= Cause(selectedcol,:)
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Identification 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!