0001 function [track indx]= search(tracks,prop,val) 0002 track = []; 0003 indx = []; 0004 switch prop 0005 case 'Id' 0006 tr =1; 0007 while isempty(track) && tr<length(tracks) 0008 if tracks(tr).Id == val 0009 track = tracks(tr); 0010 indx = tr; 0011 end 0012 tr = tr+1; 0013 end 0014 case 'Type' 0015 for tr =1 : length(tracks) 0016 if strcmp(tracks(tr).Type,val)==1 0017 track = [track;tracks(tr)]; 0018 indx = [indx; tr]; 0019 end 0020 end 0021 otherwise 0022 disp('Unknown property.'); 0023 end