Documentation of getas


Index of all files: short | long | this subdirectory only: short | long


Function Synopsis

val=getas(param,text,selectedunit,panel)

Help text

 method of class @parameter

 (c) 2011, University of Southampton
 Maintained by Stefan Bleeck (bleeck@gmail.com)
 download of current version is on the soundsoftware site: 
 http://code.soundsoftware.ac.uk/projects/aimmat
 documentation and everything is on http://www.acousticscale.org

Cross-Reference Information

This function calls This function is called by

Listing of function getas


function val=getas(param,text,selectedunit,panel)
% returns the current value of the parameter if its an float or an int

cont=param.entries;
nrent=length(cont);

if nargin<4 % search in all subsections
    panel='all';
end

nr=parameter/getentrynumberbytext.html">getentrynumberbytext(param,text,panel);

if nr>0
    type=cont{nr}.type;

    if nargin==2
        selectedunit=cont{nr}.orgunit;
    end

    handleb=parameter/gethandle.html">gethandle(param,text,panel,1);
    if  ~isequal(handleb,0) && ishandle(handleb) % yes, there is a screen representation
        strvalue=get(handleb,'string');            % value is a string, lets see what we make of it
        if ~strcmp(strvalue,'auto')
            orgvalue=str2num(strvalue); % its a float, it must have a value
            
            unitty=cont{nr}.unittype;
            if isa(unitty,'unit_none')
                rawvalue=orgvalue;
                selectedunit='';
            else
                cunit=parameter/getcurrentunit.html">getcurrentunit(param,text);
                rawvalue=unit classes/@unitconvertermaxtomin/fromunits.html">fromunits(unitty,orgvalue,cunit); % translate to rawdata
                testvalue=unit classes/@unitconvertermaxtomin/tounits.html">tounits(unitty,rawvalue,cont{nr}.orgunit); %the unit in which the min and max values are defined
                val=unit classes/@unitconvertermaxtomin/fromunits.html">fromunits(unitty,orgvalue,selectedunit); % translate to asked unit
            end
            val=unit classes/@unitconvertermaxtomin/tounits.html">tounits(unitty,rawvalue,selectedunit);
            return
        else
            val='auto';
            return
        end
    else % no representation on screen
        unittype=param.entries{nr}.unittype;
        rawval=cont{nr}.rawvalue;
        stringval=cont{nr}.stringvalue;
        if isequal(rawval,'auto')
            val=rawval;
            return
        end
        if isa(unittype,'unit_none')
            val=str2num(stringval);
        else
            val=unit classes/@unitconvertermaxtomin/tounits.html">tounits(unittype,rawval,selectedunit);
        end
    end
else
    error('getas:: error, the entry does not exist');
end

Produced by mtree2html by Hartmut Pohlheim