Mercurial > hg > ltpda
comparison m-toolbox/classes/@modelViewer/getParamsFromPanel.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % GETPARAMSFROMPANEL get a plist from the parameters on a | |
2 % parameters panel | |
3 % | |
4 % M Hewitson 30-11-08 | |
5 % | |
6 % $Id: getParamsFromPanel.m,v 1.3 2011/04/08 08:56:34 hewitson Exp $ | |
7 % | |
8 function pl = getParamsFromPanel(parampanh) | |
9 | |
10 | |
11 % Get params | |
12 pancomps = getappdata(parampanh, 'pancomps'); | |
13 | |
14 % loop over params | |
15 pl = plist(); | |
16 for j=1:size(pancomps,1) | |
17 | |
18 % handles | |
19 keyf = pancomps{j,1}; | |
20 valf = pancomps{j,2}; | |
21 actf = pancomps{j,3}; | |
22 | |
23 % Get activate status | |
24 if get(actf, 'Value') | |
25 % Get key name | |
26 key = get(keyf, 'String'); | |
27 | |
28 % Get param value | |
29 valclass = getappdata(valf, 'valClass'); | |
30 | |
31 switch valclass | |
32 case 'char' | |
33 val = get(valf, 'String'); | |
34 case 'double' | |
35 val = get(valf, 'String'); | |
36 try | |
37 val = eval(val); | |
38 end | |
39 case 'sym' | |
40 val = get(valf, 'String'); | |
41 val = sym(val); | |
42 case 'specwin' | |
43 strs = get(valf, 'String'); | |
44 idx = get(valf, 'Value'); | |
45 val = strs{idx}; | |
46 if strcmp(val, 'Kaiser') | |
47 val = specwin(val, 10, 150); | |
48 else | |
49 val = specwin(val, 10); | |
50 end | |
51 case 'time' | |
52 val = get(valf, 'String'); | |
53 val = time(val); | |
54 case 'logical' | |
55 val = eval(get(valf, 'String')); | |
56 otherwise | |
57 error(['### Unsupported value class: ' valclass]); | |
58 end | |
59 | |
60 % Add to plist | |
61 pl = append(pl, key, val); | |
62 end | |
63 end | |
64 | |
65 end |