finding the string from the text file

45 次查看(过去 30 天)
msp
msp 2013-4-18
评论: Mira Mamdouh 2019-12-23
i want to find the string from the given text file.
Example file contains : Hello welcome matlab tutorial.
if input is matlab, it should search the word(string) from the file if matched out put should string present in file else string doesn't present in the file.
  2 个评论
msp
msp 2013-4-18
Please Help Me with source code
Cedric
Cedric 2013-4-18
编辑:Cedric 2013-4-18
Here is the best help that I can provide you with, accounting for your other questions:
In the "MATLAB" section, you will find the following documents:
  • PDF labeled "MATLAB Primer".
  • PDF labeled "Mathematics".
  • PDF labeled "Programming Fundamentals".
After reading these and training so you have a fair understanding of the material, you'll be able to do much more by yourself without asking for "(complete) source code".

请先登录,再进行评论。

回答(3 个)

Matt Kindig
Matt Kindig 2013-4-18
To get you started, look at the documentation for the following functions:
doc strfind %to find whether a string is present
doc fileread %to read a text file all at once into a variable

Mahdi
Mahdi 2013-4-18
编辑:Mahdi 2013-4-18
A=fileread(filename)
B=strfind(A, WordString)
I would suggest looking at the strfind() function for more information.

msp
msp 2013-4-18
any source code available?
  1 个评论
Matt Kindig
Matt Kindig 2013-4-18
Mahdi and I just gave you functions to get you started. What further source code do you need? Keep in mind that this forum will not simply write code for you (especially because this seems a lot like homework).

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by