tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % This external file is included as part of the 'aim-mat' distribution package 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 [ret,womax]=maxstruct(str,topic,nr_second_dimension) tomwalters@0: % gets back the structitem with the highest value in "topic" tomwalters@0: % if topic is twodimensional, then "nr_second_dimension" gives the chosen tomwalters@0: % number tomwalters@0: tomwalters@0: tomwalters@0: if nargin < 3 tomwalters@0: nr=size(str,2); tomwalters@0: for i=1:nr tomwalters@0: sortcount(i)=eval(sprintf('str{%d}.%s',i,topic)); tomwalters@0: end tomwalters@0: [ismax,womax]=max(sortcount); tomwalters@0: ret=str{womax}; tomwalters@0: else tomwalters@0: nr=size(str,2); tomwalters@0: for i=1:nr tomwalters@0: sortcount(i)=eval(sprintf('str(%d).%s(%d)',i,topic,nr_second_dimension)); tomwalters@0: end tomwalters@0: [ismax,womax]=max(sortcount); tomwalters@0: ret=str{womax}; tomwalters@0: end