annotate aim-mat/tools/ca.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % support file for 'aim-mat'
tomwalters@0 2 %
tomwalters@0 3 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 4 % (c) 2011, University of Southampton
bleeck@3 5 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 6 % download of current version is on the soundsoftware site:
bleeck@3 7 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 8 % documentation and everything is on http://www.acousticscale.org
bleeck@3 9
tomwalters@0 10
tomwalters@0 11 function ca(namearg)
tomwalters@0 12 % function ca('name'): close all open graphic windows that dont contain 'name' in their title
tomwalters@0 13
tomwalters@0 14 if nargin==0
tomwalters@0 15 namearg='browser';
tomwalters@0 16 % namearg{2}='aim-mat';
tomwalters@0 17 end
tomwalters@0 18
tomwalters@0 19 if ~iscell(namearg)
tomwalters@0 20 if ~ischar(namearg)
tomwalters@0 21 disp('ca only works with strings as input')
tomwalters@0 22 else
tomwalters@0 23 name{1}=namearg;
tomwalters@0 24 end
tomwalters@0 25 % else
tomwalters@0 26 % name=namearg;
tomwalters@0 27 end
tomwalters@0 28
tomwalters@0 29
tomwalters@0 30
tomwalters@0 31
tomwalters@0 32 all_windows=get(0,'children'); % is not identic to:
tomwalters@0 33 all_windows=allchild(0);
tomwalters@0 34 for i=1:length(all_windows)
tomwalters@0 35 if strcmp(get(all_windows(i),'type'),'figure');
tomwalters@0 36 titl=get(all_windows(i),'name');
tomwalters@0 37 can_be_cleared=1;
tomwalters@0 38 for j=1:length(name)
tomwalters@0 39 if ~isempty(strfind(titl,name{j}))
tomwalters@0 40 can_be_cleared=0;
tomwalters@0 41 end
tomwalters@0 42 end
tomwalters@0 43 if can_be_cleared
tomwalters@0 44 % set(0,'ShowHiddenHandles','on')
tomwalters@0 45 close(all_windows(i));
tomwalters@0 46 end
tomwalters@0 47 end
tomwalters@0 48 end