Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Any suggestions on how to write the best text-finding code (takes a given text and searches all files in provided folder for that string of text and outputs which files contain the text, as well as the location of the text within the file)?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a folder full of text files, and I want the code to go through each file and search for a specified 5 character text (like abcde). If the 5 characters are there (in that order, like a word) then I want the code to tell me if the abcde is there and on which line. The code should then print out the 10 letters before this abcde and the 10 letters after the abcde. What is the best way to do this? It is for a protein sequence
0 comentarios
Respuestas (1)
Sid Jhaveri
el 7 de Dic. de 2016
You can refer to the links given below for information regrading the functions that that might be helpful in achieving you goal: https://www.mathworks.com/help/matlab/ref/contains.html
Basically, your code should:
1) Know which files are present in the directory and which files you would like to scan.
2) Read those files.
3) Check if the file contains the sequence.
Implementation of above steps can vary. But, I believe this information will be a good starting point for you.
0 comentarios
La pregunta está cerrada.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!