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 [selectedunit,fullunitname]=getcurrentunit(param,text,panel)
|
tomwalters@0
|
9 % returns the unit that this value is currently set to
|
tomwalters@0
|
10
|
tomwalters@0
|
11
|
tomwalters@0
|
12 cont=param.entries;
|
tomwalters@0
|
13 nrent=length(cont);
|
tomwalters@0
|
14
|
tomwalters@0
|
15 if nargin<3 % search in all subsections
|
tomwalters@0
|
16 panel='all';
|
tomwalters@0
|
17 end
|
tomwalters@0
|
18
|
tomwalters@0
|
19 nr=getentrynumberbytext(param,text,panel);
|
tomwalters@0
|
20 if nr>0
|
tomwalters@0
|
21 type=cont{nr}.type;
|
tomwalters@0
|
22 if ~strcmp(type,'float') && ~strcmp(type,'slider')
|
tomwalters@0
|
23 selectedunit='only floats have units...';
|
tomwalters@0
|
24 fullunitname='';
|
tomwalters@0
|
25 return
|
tomwalters@0
|
26 end
|
tomwalters@0
|
27
|
tomwalters@0
|
28 handleb=gethandle(param,text,panel,1);
|
tomwalters@0
|
29 if ~isequal(handleb,0) && ishandle(handleb) % yes, there is a screen representation
|
tomwalters@0
|
30 unitty=cont{nr}.unittype;
|
tomwalters@0
|
31 if isa(unitty,'unit_none')
|
tomwalters@0
|
32 selectedunit='';
|
tomwalters@0
|
33 fullunitname='';
|
tomwalters@0
|
34 else
|
tomwalters@0
|
35 handleb2=gethandle(param,text,panel,2);
|
tomwalters@0
|
36 unitnr=get(handleb2,'value');
|
tomwalters@0
|
37 possibleunitstr=getunitstrings(unitty);
|
tomwalters@0
|
38 selectedunit=possibleunitstr{unitnr};
|
tomwalters@0
|
39 possible_units_full=getunitfullstrings(unitty);
|
tomwalters@0
|
40 fullunitname=possible_units_full{unitnr};
|
tomwalters@0
|
41 end
|
tomwalters@0
|
42 return
|
tomwalters@0
|
43 else % no representation on screen
|
tomwalters@0
|
44 selectedunit=cont{nr}.orgunit;
|
tomwalters@0
|
45 return
|
tomwalters@0
|
46 end
|
tomwalters@0
|
47 else
|
tomwalters@0
|
48 error('error, the entry does not exist');
|
tomwalters@0
|
49 % val=0; % we must return a logical value otherwise it can generate difficult errors
|
tomwalters@0
|
50 end |