look for data in cell array and avoid certain data during that search
1 view (last 30 days)
Show older comments
VISHNU DIVAKARAN PILLAI on 16 Jan 2022
Answered: Max Heimann on 16 Jan 2022
Can any one help me to write a code on below condition. I have a cell which have 10 entries. I need to look specific char in that cell array if that found i need to get line number of that specific data in integer format. At the same i need to avoid certain data that will count. for example a b (c) d e (f) g here am looking for (f) so i need to get line number as 5. Because i need to avoid all data that are in () while counting for line number . after first execution i need to look for (c) and then continue for other data that are in (c).
Max Heimann on 16 Jan 2022
You could try regexp. It accepts cells of strings and returns the indices of the matches for each cell entry.
If you want to exclude certain data from the count you could eliminate those entries with regexprep or a combination of cellfun and regex first.
The correct expression for your problem depends very much on the contents of your cells.
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!