简体   繁体   中英

Is there a Matlab function that counts how many rows contain a specific string pattern?

I am working with Matlab R2020b and I am not very familiar with it unfortunately. I have a table containing 3 columns and 200 rows. I want to count all the rows which contain a certain string "j7" in column1. Is there such a function?

Not the most elegant way but I found a solution on another thread:

idx = strfind(table, 'j7');
idx = find(not(cellfun('isempty', idx)));
idx = length(idx) ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM