Chapter 4: Programming with MATLAB - FET
Chapter 4: Programming with MATLAB - FET
Chapter 4: Programming with MATLAB - FET
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
4-15<br />
Logical Operators & and the find Function<br />
>>x = [5, -3, 0, 0, 8]; y = [2, 4, 0, 5, 7];<br />
>>z = find(x&y)<br />
z =<br />
1 2 5<br />
Note that the find function returns the indices, and not the<br />
values.<br />
In the following session, note the difference between the<br />
result obtained by y(x&y) and the result obtained by<br />
find(x&y) in the previous example.<br />
>>values = y(x&y)<br />
values =<br />
2 4 7<br />
>>how_many = length(values)<br />
how_many =<br />
3<br />
Z.R.K