{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecturenotes10_15

lecturenotes10_15 - Logical Arrays Wednesday Logical Arrays...

This preview shows pages 1–6. Sign up to view the full content.

Logical Arrays Wednesday October 15, 2008

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Logical Arrays Logical arrays are arrays of “1”s and “0”s, which represent “true” and “false”, respectively Logical arrays are the result of application of a logical operation on an array of values (or potentially another logical array)
Example 1 = 9 8 7 6 5 4 3 2 1 a = = b a b 5 Note that b is NOT the same as a numerical array of ones and zeros. This is the most common form of a logical array!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Checking the data type “whos” shows a list of the variables and types: >> whos “isnumeric” also returns a value of “false” when applied to b (but is “true” when applied to a )
if/else masking We can use the logical array to perform ”if/ else” operations in the faster array arithmetic form of matlab Example: Suppose we now wanted to calculate c , where c is an array containing the square root of a , for only those values where a>5 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 12

lecturenotes10_15 - Logical Arrays Wednesday Logical Arrays...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online