1 ## Copyright (C) 2010-2012 Ben Abbott
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.
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.
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/>.
18 ## @deftypefn {Function File} {@var{V} =} isappdata (@var{h}, @var{name})
19 ## Return true if the named application data, @var{name}, exists for the
20 ## object with handle @var{h}.
21 ## @seealso{getappdata, setappdata, rmappdata}
24 ## Author: Ben Abbott <bpabbott@mac.com>
25 ## Created: 2010-07-15
27 function res = isappdata (h, name)
29 if (! (all (ishandle (h)) && ischar (name)))
30 error ("isappdata: invalid input");
35 if (isfield (data, "__appdata__") && isfield (data.__appdata__, name))
45 %! setappdata (0, "hello", "world")
46 %! assert (isappdata (0, "hello"), true)
47 %!assert (isappdata (0, "foobar"), false)