tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function [pos_max,maxval]=getmaximumleftof(where,maxpos,minpos,maxs,mins) tomwalters@0: % usage: [pos_max,maxval]=getmaximumleftof(where,womins,minvals,womaxs,maxvals) tomwalters@0: % returns the maximum that is left of point "where" tomwalters@0: % mins and maxs must be complete sets of minimums and maximums tomwalters@0: % interwoven tomwalters@0: tomwalters@0: pos_max=[]; tomwalters@0: maxval=[]; tomwalters@0: tomwalters@0: if isempty(maxpos) tomwalters@0: return; tomwalters@0: end tomwalters@0: tomwalters@0: if where < maxpos(1) tomwalters@0: return; tomwalters@0: error('getminimumleftof:: no maximum left of point'); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: nr =length(where); tomwalters@0: for j=1:nr tomwalters@0: cwhere=fround(where(j),5); tomwalters@0: nr_maxs=length(maxpos); tomwalters@0: for i=nr_maxs:-1:1 tomwalters@0: if fround(maxpos(i),5) < cwhere tomwalters@0: pos_max(j)=maxpos(i); tomwalters@0: maxval(j)=maxs(i); tomwalters@0: break; tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: % tomwalters@0: % nr_maxs=length(womaxs); tomwalters@0: % for i=nr_maxs:-1:1 tomwalters@0: % if womaxs(i) < where tomwalters@0: % pos_max=womaxs(i); tomwalters@0: % maxval=maxvals(i); tomwalters@0: % return; tomwalters@0: % end tomwalters@0: % end tomwalters@0: %