tomwalters@0: % method of class @parameter 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 tomwalters@0: function val=get(param,text,panel) tomwalters@0: % returns the current value of the parameter tomwalters@0: tomwalters@0: cont=param.entries; tomwalters@0: nrent=length(cont); tomwalters@0: tomwalters@0: if nargin <2 % in case we want the whole stucture tomwalters@0: val=cont; tomwalters@0: return tomwalters@0: end tomwalters@0: tomwalters@0: if nargin<3 % search in all subsections tomwalters@0: panel='all'; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: nr=getentrynumberbytext(param,text,panel); tomwalters@0: tomwalters@0: if nr>0 tomwalters@0: type=cont{nr}.type; tomwalters@0: tomwalters@0: handleb=gethandle(param,text,panel,1); tomwalters@0: if ~isequal(handleb,0) && ishandle(handleb) % yes, there is a screen representation tomwalters@0: if strcmp(get(handleb,'type'),'uipanel') && strcmp(type,'panel') tomwalters@0: val=getradiobutton(param,text); tomwalters@0: else tomwalters@0: strval=get(handleb,'string'); tomwalters@0: if strcmp(type,'pop-up menu') tomwalters@0: nrsel=get(handleb,'value'); tomwalters@0: val=strval{nrsel}; tomwalters@0: elseif strcmp(type,'radiobutton') tomwalters@0: val=get(handleb,'value'); tomwalters@0: elseif strcmp(type,'bool') tomwalters@0: val=get(handleb,'value'); tomwalters@0: elseif strcmp(type,'int') tomwalters@0: if strcmp(strval,'auto'); tomwalters@0: val=strval; tomwalters@0: else tomwalters@0: val=str2num(strval); tomwalters@0: end tomwalters@0: elseif strcmp(type,'float') tomwalters@0: unit=cont{nr}.orgunit; tomwalters@0: val=getas(param,text,unit,panel); %call new with unit tomwalters@0: else tomwalters@0: val=strval; tomwalters@0: end tomwalters@0: return tomwalters@0: end tomwalters@0: else % no screen representation tomwalters@0: if strcmp(type,'float') tomwalters@0: unit=cont{nr}.orgunit; tomwalters@0: val=getas(param,text,unit,panel); %call new with unit tomwalters@0: return tomwalters@0: elseif strcmp(type,'int') tomwalters@0: valf=cont{nr}.value; tomwalters@0: if ischar(valf) tomwalters@0: if strcmp(valf,'auto'); tomwalters@0: val=valf; tomwalters@0: else tomwalters@0: val=str2num(valf); tomwalters@0: end tomwalters@0: else tomwalters@0: val=valf; tomwalters@0: end tomwalters@0: elseif strcmp(type,'panel') tomwalters@0: val=getradiobutton(param,text); tomwalters@0: else tomwalters@0: val=cont{nr}.value; tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: else tomwalters@0: error('error, the entry does not exist'); tomwalters@0: % val=0; % we must return a logical value otherwise it can generate difficult errors tomwalters@0: end