MATLAB: Calculate the number of square bracket in a text file. regular expressionsstringtext file Suppose I have a txt file. How can I find the number of square bracket (let's say [ ) in a txt file? Best Answer You could consider using find() or strfind() or sum() or nnz() or == or ismember() or length() or numels() Related SolutionsMATLAB: Explain the square brackets Read the documentation http://www.mathworks.com/help/matlab/ref/function.htmlYou have to assign values toh=1,v=2leftboundary=3rightboundary=4N=5Choice=6;Then call your function[h, v] = boundary(h,v, leftboundary, rightboundary,N,Choice); MATLAB: How to compare words from two text files and get output as number of matching words % Read the files into strings:StrA = fileread(FileA);StrB = fileread(FileB);% Replace all characters, which are neither letter or the hyphen by *:StrA(~isstrprop(StrA, 'alpha') & StrA ~= '-') = '*';StrB(~isstrprop(StrB, 'alpha') & StrB ~= '-') = '*';% Split the strings to words:WordA = strsplit(StrA, '*');WordB = strsplit(StrB, '*');% Get the common words:[WordAB, iA, iB] = intersect(WordA, WordB);Perhaps you do not want to consider the case?[~, iA, iB] = intersect(lower(WordA), lower(WordB));WordAB = WordA(iA); Related QuestionFind count of repeated lettersCompute the repetition of a string in a text fileReplacing character between square bracketsNot use square brackets
Best Answer