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
you can use strcmp
... for example:
strcmp(sales,'AF7-24M')
For case insensitive string comparison, use strcmpi
instead of strcmp
.