annotate aim-mat/tools/@parameter/enable.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 % method of class @parameter
tomwalters@0 2 %
bleeck@3 3 % (c) 2011, University of Southampton
bleeck@3 4 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 5 % download of current version is on the soundsoftware site:
bleeck@3 6 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 7 % documentation and everything is on http://www.acousticscale.org
tomwalters@0 8 function param=enable(param,text,disablevalue,inbox)
tomwalters@0 9 % if it has a grafical representation then disable
tomwalters@0 10
tomwalters@0 11 cont=param.entries;
tomwalters@0 12 nrent=length(cont);
tomwalters@0 13
tomwalters@0 14 if nargin<4 % search in all subsections
tomwalters@0 15 inbox='all';
tomwalters@0 16 end
tomwalters@0 17
tomwalters@0 18 nr=getentrynumberbytext(param,text,inbox);
tomwalters@0 19 if nr>0
tomwalters@0 20 param.entries{nr}.enable=disablevalue; % save the value
tomwalters@0 21 if isfield(cont{nr},'handle') && ishandle(cont{nr}.handle{1}) % and set in the gui as well
tomwalters@0 22 hands=cont{nr}.handle;
tomwalters@0 23 for i=1:length(hands)
tomwalters@0 24 switch disablevalue
tomwalters@0 25 case 1
tomwalters@0 26 set(hands{i},'enable','on');
tomwalters@0 27 case 0
tomwalters@0 28 set(hands{i},'enable','off');
tomwalters@0 29 end
tomwalters@0 30 end
tomwalters@0 31 end
tomwalters@0 32 else
tomwalters@0 33 error('setvalue::error, the entry does not exist');
tomwalters@0 34 end