If you want to copy a plot through the property structure you need to filter out the read only properties (such as Annotation, BeingDeleted, Parent, Type). Is there a way t
I started to muck around with the previous question, trying to dynamically find out which fields were settable.
I didn't quite get it to work but I could get hold of (most of) the read only properties by using the difference between the return values of set(h)
and get(h)
.
The only property that doesn't show up here is the Parent
-property which is settable but is not supposed to be changed in the previous question.
Here is how I got the non-settable properties:
h = plot(1:0.2:10);
xx=get(h)
close all
h2 = plot(0);
settableHandles = set(h2);
settableNames = fieldnames(settableHandles);
allHandles = get(h2);
allNames = fieldnames(allHandles);
nonSettableHandles = rmfield(allHandles,settableNames);
nonSettableNames = fieldnames(nonSettableHandles)
This produces a cell of nonSettableNames
:
nonSettableNames =
'Annotation'
'BeingDeleted'
'Type'