[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #30419] set/get vs setappdata/getappdata for c
From: |
Ben Abbott |
Subject: |
[Octave-bug-tracker] [bug #30419] set/get vs setappdata/getappdata for custom properties |
Date: |
Mon, 12 Jul 2010 09:09:52 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4 |
URL:
<http://savannah.gnu.org/bugs/?30419>
Summary: set/get vs setappdata/getappdata for custom
properties
Project: GNU Octave
Submitted by: bpabbott
Submitted on: Mon 12 Jul 2010 05:09:51 AM EDT
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name: bpabbott
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Mac OS
_______________________________________________________
Details:
Matlab doesn't allow users to create new properties for its objects in the
way Octave does. Matlab's "addproperty" serves a different purpose than
Octaves'. The Matlab variant adds a custom property to a COM object, which are
available on Microsoft Windows systems only.
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/addproperty.html
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/bqdwu3j.html
Instead Matlab uses setappdata(), getappdata(), isappdata() to allow custom
properties to be managed. The first two, work in a manner consistent with
set() and get(), except that they are case sensitive. The latter works as ...
isappdata = @(h, name) any (strcmp (name, fieldnames (getappdata (h))));
A simple example of this is found in the mechanism by which Matlab manages
the hold state for plots.
>> clf
>> plot (1:10)
>> p = getappdata (gca)
p =
PlotColorIndex: 2
PlotLineStyleIndex: 1
>> hold all
>> p = getappdata (gca)
p =
PlotColorIndex: 2
PlotLineStyleIndex: 1
PlotHoldStyle: 1
>> hold off
>> p = getappdata (gca)
p =
PlotColorIndex: 2
PlotLineStyleIndex: 1
PlotHoldStyle: 0
>> hold on
>> p = getappdata (gca)
p =
PlotColorIndex: 2
PlotLineStyleIndex: 1
PlotHoldStyle: 0
Regarding this example, I'd have responded to the "hold all" discussion but
on the tracker, but was out of email contact.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?30419>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #30419] set/get vs setappdata/getappdata for custom properties,
Ben Abbott <=