Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indexing into cells using identifiers

I have a cell array in MATLAB that is reasonably large with very mixed data called sales. One column is a store identifier and that store identifier is a mix of letters and numbers (i.e. AF7-24M). I want to grab all the rows in sales where the store identifier is equal to a particular store identifier. I tried doing some logical indexing but I'm having trouble getting it to work...

I also would rather not just loop over all the rows because I need to do this multiple times and it's quite a slow process

like image 265
sedavidw Avatar asked Apr 12 '26 14:04

sedavidw


1 Answers

you can use strcmp... for example:

strcmp(sales,'AF7-24M')

For case insensitive string comparison, use strcmpi instead of strcmp.

like image 63
bla Avatar answered Apr 16 '26 11:04

bla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!