look for data in cell array and avoid certain data during that search

1 次查看(过去 30 天)
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).

回答(1 个)

Max Heimann
Max Heimann 2022-1-16
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.

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by