This preview shows page 1. Sign up to view the full content.
Unformatted text preview: vec1 = data(end:-1:6), set(1:4) % Since the end started from 10, to make % last 5 elements from 10, we need to count 6 times(such as 10,9,8,7,6) . vec2 = data(end:-1:1) % reverse the data from the back to front by using % colon operator. vec3 = data (data> 8 | data<2) % I used value of (or) operator. vec3length = length(vec3) vec4 = data(data>4 & data< 8.5) % I used valus of (and) operator vec4sum = sum(vec4) vec5 = [data .* set] % multiply data and set each by elements dataAvg = sum(vec5)/sum(set) % to get an average, I devided the total added number of vec5 by summed number of set newData = [data]; newData(data>5) = -1...
View Full Document
This note was uploaded on 11/10/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.
- Fall '08
- Computer Science