vector array in matlab
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ali hassan
am 10 Feb. 2022
Kommentiert: Adam Danz
am 10 Feb. 2022
assume i have folllowing vector column named as ALT_digit_
i want to know the number of times 'hi' comes in the vector column.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Adam Danz
am 10 Feb. 2022
Bearbeitet: Adam Danz
am 10 Feb. 2022
1 Kommentar
Adam Danz
am 10 Feb. 2022
If your only string values are 'hi' 'lo' or '' and your Matlab release is R2016b or later, this solution is perfectly fine. But if you're using a release prior to 16b or combinations of 'hi' and 'lo', consider using a different method.
Image Analyst
am 10 Feb. 2022
Yes another way : using ismember():
ALT_digit = {'lo', '', '', '', 'lo', '', '', '', 'lo', '', 'abc'}
rows = ismember(ALT_digit, 'lo')
count = sum(rows)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Characters and Strings 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!