converting cell to str
2 次查看(过去 30 天)
显示 更早的评论
Hi.
I am trying to load a bunch of log files, and then find certain keywords in it.
C is the cell containing the 40 input files in which i want to find certain keywords.
iscellstr(C) = 0
Since i cannot use C in strfind, i have to convert it into C2 as:
C2 = [C{:,i}]
However, here's the main problem. C contains all the 40 files i want to read, but C2 contains only one, the 40th file.
Any suggestions about the conversion will be appreciated.
Thanks in advance,
Mahesh
0 个评论
采纳的回答
Greig
2015-9-3
C2 = cellfun(@(x) strfind(x, 'MyPattern'), C, 'UniformOutput', 0);
This returns a cell that contains the indices for each element of C where "MyPattern' is found. Many may be empty, so this is why UniformOutput is specified as zero (i.e., non-uniform output).
You may need to use something like
cellfun(@isempty, C2)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!