This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 Boolean variables, tests Yes no answers, tests Logical operators Application of logical operators to arrays Conditional statements Lecture 6: conditional statements if / then / else clauses Reference: book, Chapter 4 Additional material: Lecture_06.m (available on bSpace) Yes/no answers, tests In matlab, the following statements are equivalent: YES or true or 1 NO or false or 0 In other words the way for matlab to encode a positive answer is to use a boolean variable equal to 1. The way to encode a negative answer is to use a boolean variable equal to 0. Boolean means equal to 0 or 1 A test is a question to which the answer is yes or no. The result is encoded by matlab as a boolean variable. For example if the test is Is the age of the E7 instructor less than 100 years The answer should be: 1 Tests Assignment (the variable a is assigned to 11) Tests Assignment (the variable a is assigned to 11) Test. different from an assignment: it Test....
View
Full
Document
This note was uploaded on 03/04/2009 for the course E 7 taught by Professor Patzek during the Spring '08 term at University of California, Berkeley.
 Spring '08
 Patzek

Click to edit the document details