I'm looking for a way to reference parts of strings that are stored in a cell array. I need to do so in order to make a logical statement that will match strings I am looking for to the parts of the strings in the cell array.
Lets say my cell array looks like this:
cellname = { 'B_1J_1234_1236' , 'A_1W_2345_2349' , 'C_2J_9876_9879' , 'B_1W_5432_5438'}
And I am looking to find the string in the cell array that satisfies:
'B'as the first part of the string'1W'as the second part of the string- The first number (third part) is less than 5434
- The second number (fourth part) is greater than 5436
I know I can get an index of the element I am looking for that satisfies my first two search conditions by writing:
find(strncmp(cellname,'B_1W',4))
But I cannot find a way to include the latter conditions. Any ideas?
EDIT: Ideally, I guess I'd like someway to do:
find(strncmp(cellname,'B_1W',4) & cellname{ "any element" } (6:9) < 5434 & cellname{ "any element" } (11:14) > 5436)
But it is the referencing of a part of "any element" that I can't figure out how to do.