11180
|
1 ## Copyright (C) 2010 Ben Abbott |
|
2 ## |
|
3 ## This program is free software; you can redistribute it and/or modify |
|
4 ## it under the terms of the GNU General Public License as published by |
|
5 ## the Free Software Foundation; either version 2 of the License, or |
|
6 ## (at your option) any later version. |
|
7 ## |
|
8 ## This program is distributed in the hope that it will be useful, |
|
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 ## GNU General Public License for more details. |
|
12 ## |
|
13 ## You should have received a copy of the GNU General Public License |
|
14 ## along with Octave; see the file COPYING. If not, see |
|
15 ## <http://www.gnu.org/licenses/>. |
|
16 |
|
17 ## -*- texinfo -*- |
|
18 ## @deftypefn {Function File} {@var{value} =} getappdata (@var{h}, @var{name}) |
|
19 ## Returns the @var{value} for named application data for the object(s) with |
|
20 ## handle(s) @var{h}. |
|
21 ## @end deftypefn |
|
22 |
|
23 ## Author: Ben Abbott <bpabbott@mac.com> |
|
24 ## Created: 2010-07-15 |
|
25 |
|
26 function val = getappdata (h, name) |
|
27 |
|
28 if (! (all (ishandle (h)) && ischar (name))) |
|
29 error ("getappdata: invalid input.") |
|
30 endif |
|
31 |
|
32 appdata(numel(h)) = struct(); |
|
33 for nh = 1:numel(h) |
|
34 appdata(nh) = get (h(nh), "__appdata__"); |
|
35 end |
|
36 if (nh > 1) |
|
37 val = {appdata.(name)}; |
|
38 else |
|
39 val = appdata.(name); |
|
40 endif |
|
41 |
|
42 endfunction |
|
43 |