I need to write a program in matlab that searches for specific key words in a text file and then Count the number of this specific word in text.
How can I search a text file for Count specific words using matlab?
551 Views Asked by eman At
2
There are 2 best solutions below
0
rinkert
On
Matlab actually has a function strfind which can do this for you. Check the Mathworks doc for more details.
The content of the text file should be stored in a variable:
text = fileread('filename.txt')
Related Questions in MATLAB
- How to open and read video stream in Matlab
- Interpolation and replace zeroes
- How can I fix my code to do line by line conditional statements in Matlab
- matlab crash during acquisition of pointgrey images
- Calling text file
- Apply gaussian filter on text
- re-plotting of data on same GUI axes in matlab
- Issue with nume1 in MATLAB
- Multiply two variables in Matlab with vpa - high precision
- ODE - Solving Parameter Dependent on Variable [Matlab]
- Need help in detecting multiple blobs
- How does TIC TOC in matlab work?
- Image based steganography that survives resizing?
- lowering computaional cost in finding the location of minimum distance
- FFT Filtering of signal
Related Questions in TEXT-PROCESSING
- PHP split string into known tokens and remaining words add to single-worded array
- C# implementation of Dictionary to Create an index of words
- Why this exclusion not working for long sentences?
- Omit words in a text
- Getting repeated lines with awk in Bash
- Algorithm to group parts of documents that belong together
- Text Processing - Converting fixed width text files to delimited
- How to append to the lines with fewer columns in a tab separated text file?
- identifying leading line space - shell script
- Count duplicates from several files
- Merge all .wav files in a folder that start by the same prefix
- How can I search a text file for Count specific words using matlab?
- Add filename before first occurrence of a character in all lines for all files in a given folder
- Put file names into text
- Replace date in a txt file having xml
Related Questions in TEXT-PARSING
- Duplicate Block in Tab Delimited File and replace a word
- Json Files parsing
- How do I access individual nodes in the dependency tree and constituency tree returned by the Stanford Parser?
- python - how to parse semi structured text (cran.all.1400)
- Parse Json from Json array in Android
- How can I search a text file for Count specific words using matlab?
- How can I capture this computer output with a txr query?
- How to remove unnecessary parsing related info from Tika parsing output
- Trim() vs IndexOf()
- Text file parsing C++
- Parsing data from a string
- Removing brackets and quotes from print in Python 2.7
- If statement dilemma for text parsing
- preg_split and multiple delimiters
- Why does my regex not work inside string.match()?
Related Questions in TEXTSCAN
- usage of textscan in Octave 3.8.2
- How do I read comma separated doubles from text file into MATLAB?
- How can I search a text file for Count specific words using matlab?
- Matlab: reading text file information with blanks
- store string and integer type CSV file into a matrix matlab
- Use textscan in Matlab to output data
- Matlab - Help using text scan, how to ignore comments and header columns?
- Avoid typing conversion specifier for every column in large table in `textscan`
- Nested textscan statements
- importing a CSV file in MATLAB
- How do i read text file using command textscan
- Error "std::exception" with function textscan in Matlab 2013b
- Matlab: Import .csv-file via textscan
- Decimating large data files from disk in MATLAB?
- matlab textscan gives me wrong number of lines
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
First look at how to read a text file using Matlab, then read the entire data into a cell array using
textscanfunction which is an in-built function in Matlab and compare each element of the array with specific keyword usingstrcmp.I have provided a function that takes filename and keyword as input and outputs the count of keywords present in the file.