matlab - Taking average of one column with w.r.to other column -


i have 2 columns in .std file. want average of second column values corresponding values ranging value (eg. 1.0- 1.9) in first column how can program in matlab?

say, a name of 2 column matrix. if want find of values in first column in range of 1.0 - 1.9 , use entries find mean in second column can this:

f = find(a(:,1)>=1 & a(:,1)<=1.9) m = mean(a(f,2)) 

find find values lie within range , return index, , a(f,2) accesses indices in in second column , takes mean. can 1 line so:

m = mean(a((a(:,1)>=1 & a(:,1)<=1.9),2)) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -