Mercurial > hg > octave-lyh
annotate scripts/miscellaneous/getappdata.m @ 12575:d0b799dafede
Grammarcheck files for 3.4.1 release.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 04 Apr 2011 15:33:46 -0700 |
parents | b0084095098e |
children | b4bd0bef55b6 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2010-2011 Ben Abbott |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
2 ## |
11180 | 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. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
7 ## |
11180 | 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. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
12 ## |
11180 | 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}) | |
12575
d0b799dafede
Grammarcheck files for 3.4.1 release.
Rik <octave@nomad.inbox5.com>
parents:
11589
diff
changeset
|
19 ## Return the @var{value} for named application data for the object(s) with |
11180 | 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))) | |
11589
b0084095098e
missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents:
11588
diff
changeset
|
29 error ("getappdata: invalid input"); |
11180 | 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 |