PSYB03H3 Lecture Notes - Lecture 5: Lookup Table, For Loop, Empty String

63 views5 pages
School
Department
Course
Professor

Document Summary

Extract the third sentence from this array: >>p=["this is 1. Flowers bloom. ": >>pos= strfind(p, "flowers bloom. ", >>s = p(pos:end, the identity of the 3rd sentence is hardcoded and so is its end location, the solution works for this example but not for most other examples ("this is 1. Flowers bloom. ") 3rd sentence isn"t the last one anymore: also, that defeats the purpose of the exercise: why would i search for a. If may be more efficient when dealing with multiple variables and their combined outcome. If (s_old(k)==". ")|(s_old(k)==",": s_new = [s_new ]; %add space after periods and commas, end, end, disp(s_new, >>yes, this sentence needs formatting. Nan 0 3: %%but this is much quicker, >>a = [4 1 0;nan 0 9], b = sqrt(a, b = 2 1 0. Infinite loop: a sequence of statements that execute endlessly: because the termination condition is never met, because of infinite recursion, etc, strategies to handle unintentional loops, ctrl+c.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents