How to get row index based on two columns
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mekala balaji
am 28 Nov. 2018
Beantwortet: Andrei Bobrov
am 28 Nov. 2018
I have below cell array, I want to get the row index if 2nd column is "Continuous" & 3rd Column is <=80.
12 Continuous 891
72 Continuous 23
82 Continuous 562
222 Break 25
132 Continuous 23
832 Break 23
833 Break 23
Desired output(row index):
2
5
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 28 Nov. 2018
C = {12 'Continuous' 891
72 'Continuous' 23
82 'Continuous' 562
222 'Break' 25
132 'Continuous' 23
832 'Break' 23
833 'Break' 23};
C = cell2table(C);
rows = find(ismember(T.C2,'Continuous') & T.C3 <= 80);
0 Kommentare
Weitere Antworten (1)
Jos (10584)
am 28 Nov. 2018
tf1 = strcmp(YourCellArray(:,2), 'Continuous')
tf2 = cat(1, YourCellArray{:,3}) <= 80
DesiredRows = find(tf1 & tf2)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!