Do you want to search for 'bla' within the text in each element of the cell array, or for elements that are 'bla' exactly? If you explain this detail, then your question would be easier to answer. If you are searching for text that has 'bla' as part of the text, then starting in R2016b you can use the “contains” function, as Alexander Cranney pointed out. Index = find(contains(C,'bla')); The function "contains" returns a logical array. This type of logical indexing can be used to make many workflows more efficient. For more on using logical arrays, refer to the documentation: https://www.mathworks.com/help/matlab/math/array-indexing.html#MatrixIndexingExample-3 https://www.mathworks.com/help/matlab/matlab_prog/find-array-elements-that-meet-a-condition.html In previous versions of MATLAB (before R2016b), you can use the “strfind” function. However, “strfind” returns a cell array of indices. For any input cell whose text does not contain 'bla', “strfind” returns an empty cell. Use “isempty” and “cellfun” with the “find” function to find the empty cells. IndexC = strfind(C,'bla'); Index = find(not(cellfun('isempty',IndexC))) If you are searching for text that is exactly 'bla', then see Jos’ answer. Answer from Jan on mathworks.com
🌐
MathWorks
mathworks.com › matlab › language fundamentals › data types › characters and strings
strfind - Find strings within other strings - MATLAB
If pat is not found, then strfind ... scalar, then strfind returns a vector of type double. If str is a cell array of character vectors or a string array, then strfind returns a cell array of vectors of type double....
🌐
Octave
octave.sourceforge.io › octave › function › strfind.html
Function Reference: strfind - Octave Forge - SourceForge
If a cell array of strings cellstr is specified then idx is a cell array of vectors, as specified above. Examples: strfind ("abababa", "aba") ⇒ [1, 3, 5] strfind ("abababa", "aba", "overlaps", false) ⇒ [1, 5] strfind ({"abababa", "bebebe", "ab"}, "aba") ⇒ { [1,1] = 1 3 5 [1,2] = [](1x0) ...
🌐
Narkive
comp.soft-sys.matlab.narkive.com › SSD3UPjX › strfind-for-cell-array-of-strings
strfind for cell array of strings
The command r = cellfun(@(s) find(cellfun(@numel,regexp(s,array2,'once'))),array1,'uni',0) % is equaivalent to: r = cell(size(array1)); for i = 1:numel(array1) s = array1{i}; ri = regexp(s,array2,'once'); t = zeros(size(ri)); for j = 1:numel(ri) t(j) = numel(ri{j}); end r{i} = find(t); end ...
Find elsewhere
🌐
UBC Computer Science
cs.ubc.ca › ~murphyk › Software › matlabTutorial › html › StringsCellsStructsSets.html
Strings, Cells, Structs, and Sets
A = 'testString'; test1 = ... test4 = strncmpi(A,'TEST',4) % same as above, but ignore case. ... We can find the occurrences of one substring inside another using the strfind() function, or search for all strings, (stored as rows in a matrix or cells in a cell array) ...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 432559-find-the-cell-array-contains-a-specific-string
find the cell array contains a specific string - MATLAB Answers - MATLAB Central
November 28, 2018 - https://www.mathworks.com/matlabcentral/answers/432559-find-the-cell-array-contains-a-specific-string#answer_349405 · Cancel Copy to Clipboard · Use strfind: >> idc = strfind(file,'bore'); % search for 'bore' in all cells.
🌐
UBC Computer Science
cs.ubc.ca › ~murphyk › Software › matlabTutorial › html › dataStructures.html
Strings, Cells, Structs, Containers, and Sets
A = 'testString'; test1 = ... test4 = strncmpi(A,'TEST',4) % same as above, but ignore case. ... We can find the occurrences of one substring inside another using the strfind() function, or search for all strings, (stored as rows in a matrix or cells in a cell array) ...
🌐
Wikibooks
en.wikibooks.org › wiki › MATLAB_Programming › Strings
MATLAB Programming/Strings - Wikibooks, open books for an open world
Searching a cell array of strings can be done with the "strmatch", "strfind", and "regexp" functions.
🌐
Google Groups
groups.google.com › g › comp.soft-sys.matlab › c › gpylYTARWv8
Find substring in cell array of numbers and strings
January 25, 2017 - ) ans = 1 0 0 0 0 0 0 1 1 The inner cellfun is able to apply strfind to even numerical cells because, I presume, Matlab treats numerical arrays and strings the same way. A string is just an array of numbers representing the character codes. The outer cellfun identifies all cells for which the inner cellfun found a match, and the prefix tilde turns that into all cells for which there was NO match.
🌐
MathWorks
mathworks.com › matlabcentral › fileexchange › 9008-strfind-m
strfind.m - File Exchange - MATLAB Central
November 14, 2005 - K = STRFIND(STRS,STR) looks through the rows of the cell array of strings STRS to find strings that contain the string STR, returning the matching row indices.