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_min,minval,index]=getminimumleftof(where,maxpos,minpos,maxs,mins) tomwalters@0: % usage: [pos_min,minval]=getminimumleftof(where,womins,minvals,womaxs,maxvals) tomwalters@0: % returns the minimum 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_min=[]; tomwalters@0: minval=[]; tomwalters@0: index=-1; tomwalters@0: tomwalters@0: if isempty(maxpos) tomwalters@0: return; tomwalters@0: end tomwalters@0: if where < minpos(1) tomwalters@0: return; tomwalters@0: error('getminimumleftof:: no minimum left of point'); tomwalters@0: end tomwalters@0: tomwalters@0: nr =length(where); tomwalters@0: for j=1:nr tomwalters@0: cwhere=where(j); tomwalters@0: nr_mins=length(minpos); tomwalters@0: for i=nr_mins:-1:1 tomwalters@0: % if fround(minpos(i),5) < fround(cwhere,5) tomwalters@0: % pos_min(j)=minpos(i); tomwalters@0: % minval(j)=mins(i); tomwalters@0: % break; tomwalters@0: % end tomwalters@0: if minpos(i) < cwhere tomwalters@0: pos_min(j)=minpos(i); tomwalters@0: minval(j)=mins(i); tomwalters@0: index=i; tomwalters@0: break; tomwalters@0: end tomwalters@0: end tomwalters@0: end