lab08 finding nemo

조회 수: 6 (최근 30일)
kioko kinyae
kioko kinyae 2020년 10월 23일
댓글: Image Analyst 2020년 10월 23일
You should turn in: 1. A file named Lab08.m, and a screenshot of you running findingNemo() from the command line. Instructions: 1. On Canvas you will find a file named findingNemo.m and another named nemo.txt. The first contains code which will read in strings from nemo.txt, then call Lab08(string) on each line of nemo.txt. Your job is to write Lab08.m. 2. The Lab08 function will take in a string as input and will return an integer n as output. 3. The value of n will be the nth word in the input string, where n is the location of the substring 'Nemo'. a. Please note that you will need to match whole words only, so 'aNemone' and 'Leonard Nemoy' should not be counted b. All strings will end with punctuation, so you do not need to work out the edge case of a string like 'I found Nemo', which could cause significant problems 4. Once the value of n has been determined (hint: count the number of spaces before the index at which you found Nemo), use the statement fprintf('I found Nemo at word %d!\n',n); to print the results. 5. If Nemo is not in the string, instead use the statement fprintf('I couldn''t find Nemo, sorry.\n'); and set n equal to negative one. 6. If Nemo is in the string multiple times, return the location of its first appearance. 7. Please be aware that if your file and function names are not the same as those expected in findingNemo(), or if all three files are not in the same folder, your code will not work correctly. 8. There are multiple ways to approach this problem, but the regular expressions from Lab 07 may be useful here.
  댓글 수: 2
Star Strider
Star Strider 2020년 10월 23일
That appears to be an interesting homework assignment!
Thank you for posting it!
Image Analyst
Image Analyst 2020년 10월 23일
Thanks for the announcement. If you need help, read this link.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by